├── .gitignore
├── Resources
├── views
│ ├── Menu
│ │ ├── menuItem.html.twig
│ │ └── menuItems.html.twig
│ ├── News
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── index.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── postAbstract.html.twig
│ │ └── indexAbstract.html.twig
│ ├── Page
│ │ ├── post.html.twig
│ │ ├── postAbstract.html.twig
│ │ ├── pageFront.html.twig
│ │ └── pageContact.html.twig
│ ├── Event
│ │ ├── index.html.twig
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── indexAbstract.html.twig
│ │ ├── event.html.twig
│ │ └── postAbstract.html.twig
│ ├── Person
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── index.html.twig
│ │ ├── avatar.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── indexAbstract.html.twig
│ │ └── postAbstract.html.twig
│ ├── Place
│ │ ├── index.html.twig
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── postAbstract.html.twig
│ │ └── indexAbstract.html.twig
│ ├── Search
│ │ ├── ajax.html.twig
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── index.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── ajaxAbstract.html.twig
│ │ ├── relatedSection.html.twig
│ │ ├── noResults.html.twig
│ │ ├── searchSection.html.twig
│ │ ├── searchResults.html.twig
│ │ ├── postAbstract.html.twig
│ │ ├── indexAbstract.html.twig
│ │ └── filterPanel.html.twig
│ ├── Theme
│ │ ├── index.html.twig
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── indexAbstract.html.twig
│ │ └── postAbstract.html.twig
│ ├── Default
│ │ ├── index.html.twig
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── postAbstract.html.twig
│ │ ├── itemAbstract.html.twig
│ │ └── indexAbstract.html.twig
│ ├── Document
│ │ ├── index.html.twig
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── indexAbstract.html.twig
│ │ └── postAbstract.html.twig
│ ├── Resource
│ │ ├── index.html.twig
│ │ ├── item.html.twig
│ │ ├── post.html.twig
│ │ ├── itemAbstract.html.twig
│ │ ├── postAbstract.html.twig
│ │ └── indexAbstract.html.twig
│ ├── Section
│ │ ├── title.html.twig
│ │ ├── searchResults.html.twig
│ │ ├── team.html.twig
│ │ ├── standard.html.twig
│ │ ├── largeAndMedium.html.twig
│ │ ├── featured.html.twig
│ │ ├── largeAndSmall.html.twig
│ │ ├── featuredAndSmall.html.twig
│ │ └── largeGrid.html.twig
│ ├── Item
│ │ ├── eventContent.html.twig
│ │ ├── featuredItem.html.twig
│ │ └── itemContent.html.twig
│ ├── Partial
│ │ ├── relatedResources.html.twig
│ │ ├── items.html.twig
│ │ ├── featuredImg.html.twig
│ │ ├── connectedResources.html.twig
│ │ ├── searchResults.html.twig
│ │ ├── connected.html.twig
│ │ ├── social.html.twig
│ │ ├── socialDropdown.html.twig
│ │ └── share.html.twig
│ ├── Navigation
│ │ ├── sideMenu.html.twig
│ │ ├── topHeader.html.twig
│ │ └── footer.html.twig
│ ├── 404.html.twig
│ └── Carousel
│ │ └── carousel.html.twig
├── public
│ ├── images
│ │ ├── logo.png
│ │ ├── no-profile.png
│ │ └── placeholder.png
│ ├── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.ttf
│ │ └── fontawesome-webfont.woff
│ └── js
│ │ ├── foundation
│ │ ├── foundation.alert.js
│ │ ├── foundation.offcanvas.js
│ │ ├── jquery.cookie.js
│ │ ├── foundation.accordion.js
│ │ ├── foundation.tab.js
│ │ ├── foundation.equalizer.js
│ │ ├── foundation.magellan.js
│ │ └── foundation.dropdown.js
│ │ ├── vendor
│ │ ├── jquery.cookie.js
│ │ ├── placeholder.js
│ │ ├── rem.min.js
│ │ └── jquery.appear.js
│ │ └── facetsearch.js
└── config
│ ├── services.yml
│ └── routing.yml
├── PostType
├── Resource.php
├── Theme.php
├── Project.php
├── Search.php
├── Place.php
├── Role.php
├── News.php
├── Person.php
├── Page.php
├── Document.php
└── Event.php
├── Controller
├── ResourceController.php
├── DefaultController.php
├── PageController.php
├── RelatedController.php
├── NewsController.php
├── PlaceController.php
├── ProjectController.php
├── DocumentController.php
├── CarouselController.php
├── PersonController.php
├── ThemeController.php
└── EventController.php
├── composer.json
├── FacetedSearch
├── FacetOption
│ ├── FacetOptionPost.php
│ └── FacetOption.php
├── Facets
│ ├── FacetPostType.php
│ ├── FacetOrder.php
│ ├── FacetOrderBy.php
│ ├── FacetPostToPost.php
│ └── Facet.php
└── SearchFormHelper.php
├── EventListener
└── NotFoundListener.php
├── Tests
└── Controller
│ ├── PageControllerTest.php
│ └── DefaultControllerTest.php
├── OutlandishAcadOowpBundle.php
└── Command
├── ModifyAcfFieldCommand.php
├── AddAcfGroupCommand.php
├── InstallPostTypeCommand.php
├── AddAcfFieldCommand.php
└── ConvertPostTypeCommand.php
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea
2 |
--------------------------------------------------------------------------------
/Resources/views/Menu/menuItem.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "OutlandishOowpBundle:Helper:menuItem.html.twig" %}
--------------------------------------------------------------------------------
/Resources/views/News/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:News:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/News/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:News:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Page/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Page:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Event/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Event:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Event/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Event:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Event/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Event:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/News/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:News:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Person/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Person:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Person/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Person:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Place/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Place:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Place/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Place:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Place/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Place:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Search/ajax.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:ajaxAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Search/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Search/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Theme/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Theme/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Theme/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Default/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Default:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Default/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Default:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Default/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Default:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Document/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Document:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Document/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Document:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Document/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Document:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Person/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Person:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Place/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Place/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Resource/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Resource/item.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Resource/post.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Search/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/News/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Page/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Default:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Place/indexAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Resource/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Resource/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:postAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Search/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Default:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Theme/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/Document/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:itemAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/views/News/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:postAbstract.html.twig' %}
2 |
--------------------------------------------------------------------------------
/Resources/views/Resource/indexAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:indexAbstract.html.twig' %}
--------------------------------------------------------------------------------
/Resources/public/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/outlandishideas/AcadOowpBundle/master/Resources/public/images/logo.png
--------------------------------------------------------------------------------
/Resources/public/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/outlandishideas/AcadOowpBundle/master/Resources/public/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/Resources/public/images/no-profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/outlandishideas/AcadOowpBundle/master/Resources/public/images/no-profile.png
--------------------------------------------------------------------------------
/Resources/public/images/placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/outlandishideas/AcadOowpBundle/master/Resources/public/images/placeholder.png
--------------------------------------------------------------------------------
/Resources/public/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/outlandishideas/AcadOowpBundle/master/Resources/public/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/Resources/public/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/outlandishideas/AcadOowpBundle/master/Resources/public/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/Resources/public/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/outlandishideas/AcadOowpBundle/master/Resources/public/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/PostType/Resource.php:
--------------------------------------------------------------------------------
1 |
{{ section.title | raw }}
3 | {% else %}
4 | {{ section.title | raw }}
5 | {% endif %}
--------------------------------------------------------------------------------
/Resources/views/Person/avatar.html.twig:
--------------------------------------------------------------------------------
1 | {% if size is not defined %}
2 | {% set size = 'small' %}
3 | {% endif %}
4 |
5 |
--------------------------------------------------------------------------------
/Resources/views/Item/eventContent.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Item:itemContent.html.twig' %}
2 |
3 | {% block item_subtitle %}
4 |
5 | {{ item.dateString("j M Y", true) | raw }}
6 |
7 | {% endblock %}
8 |
--------------------------------------------------------------------------------
/PostType/Theme.php:
--------------------------------------------------------------------------------
1 | 0 %}
2 |
3 | Related Resources
4 |
5 | {#{{ search_form.post_type | raw }}#}
6 |
7 | {% include 'OutlandishAcadOowpBundle:Partial:searchResults.html.twig' %}
8 |
9 | {% endif %}
--------------------------------------------------------------------------------
/Controller/ResourceController.php:
--------------------------------------------------------------------------------
1 | array('sortable' => 'any','cardinality' => 'many-to-many'),
12 | );
13 | }
--------------------------------------------------------------------------------
/PostType/Search.php:
--------------------------------------------------------------------------------
1 | 0 %}
2 |
3 | {% include 'OutlandishAcadOowpBundle:Partial:items.html.twig' %}
4 | {% if items | length > 9 %}
5 |
6 | {% endif %}
7 |
8 | {% else %}
9 | Sorry, nothing matches your search :(
10 | {% endif %}
--------------------------------------------------------------------------------
/PostType/Place.php:
--------------------------------------------------------------------------------
1 | array('sortable' => 'any','cardinality' => 'many-to-many'),
12 | );
13 |
14 | public function postTypeIcon() {
15 | return self::$menuIcon;
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/Resources/views/Event/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:itemAbstract.html.twig' %}
2 |
3 | {% block itemInclude %}
4 |
5 | {% include 'OutlandishAcadOowpBundle:Item:eventContent.html.twig' with {'item': item} %}
6 |
7 | {% endblock %}
8 |
9 | {% block itemNoImageInclude %}
10 |
11 | {% include 'OutlandishAcadOowpBundle:Item:eventContent.html.twig' with {'item': item} %}
12 |
13 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Search/relatedSection.html.twig:
--------------------------------------------------------------------------------
1 | {% block searchResultsContent %}
2 | {% if search.post_count > 1 %}
3 |
4 |
5 |
6 |
7 |
8 |
9 | {% include "OutlandishAcadOowpBundle:Search:searchResults.html.twig" %}
10 |
11 |
12 | {% endif %}
13 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Partial/items.html.twig:
--------------------------------------------------------------------------------
1 | {% if not excerpt_length %}{% set excerpt_length = 400 %}{% endif %}
2 | {% if items |length > 0 %}
3 | {% for item in items %}
4 |
5 | {% set twig_template = "OutlandishAcadOowpBundle:" ~ item.post_type|capitalize ~ ":item.html.twig" %}
6 | {% include twig_template with { post: item, image: 'item-image-12', date: 'date', excerpt_length: excerpt_length } %}
7 |
8 | {% endfor %}
9 | {% endif %}
10 |
--------------------------------------------------------------------------------
/Resources/views/Navigation/sideMenu.html.twig:
--------------------------------------------------------------------------------
1 | Find out more
2 |
--------------------------------------------------------------------------------
/Resources/views/Partial/featuredImg.html.twig:
--------------------------------------------------------------------------------
1 | {% if image == 'none' %}{% set image = 'large' %}{% endif %}
2 |
3 |
4 | {{ post.featuredImage(image) | raw }}
5 | {% if post.featuredImageTitle() %}
6 |
{{ post.featuredImageTitle() | raw }}
7 | {% endif %}
8 | {% if post.featuredImageDescription() %}
9 |
{{ post.featuredImageDescription() | raw }}
10 | {% endif %}
11 |
--------------------------------------------------------------------------------
/Resources/config/services.yml:
--------------------------------------------------------------------------------
1 | services:
2 | outlandish_acadoowp.faceted_search.search:
3 | class: Outlandish\AcadOowpBundle\FacetedSearch\Search
4 | arguments: [@outlandish_routemaster.query_manager, @outlandish_oowp.post_manager]
5 |
6 | kernel.listener.outlandish.notfound:
7 | class: Outlandish\AcadOowpBundle\EventListener\NotFoundListener
8 | arguments: [@templating.engine.twig]
9 | tags:
10 | - {name: kernel.event_listener, event: kernel.exception, method: onKernelException}
--------------------------------------------------------------------------------
/FacetedSearch/FacetOption/FacetOptionPost.php:
--------------------------------------------------------------------------------
1 | ID, $post->title(), $selected);
21 | $this->post = $post;
22 | }
23 |
24 | }
--------------------------------------------------------------------------------
/Resources/views/Search/noResults.html.twig:
--------------------------------------------------------------------------------
1 |
2 | Unfortunately, we couldn't find anything for "{{ search.query_vars.s }}". The below recently added resources might interest you.
3 |
4 | {% set items = post.recentResources() %}
5 |
--------------------------------------------------------------------------------
/Resources/views/Partial/connectedResources.html.twig:
--------------------------------------------------------------------------------
1 | {% if connected_resources | length > 0 %}
2 |
3 | Connected Resources
4 |
14 |
15 | {% endif %}
16 |
--------------------------------------------------------------------------------
/Resources/views/Section/searchResults.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% for item in section.items %}
6 | {% block sectionItemResults %}
7 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
8 | 'item': item,
9 | 'excerpt_length': 150,
10 | 'classes' : ''} %}
11 | {% endblock %}
12 | {% endfor %}
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/PostType/Role.php:
--------------------------------------------------------------------------------
1 | array('sortable' => 'any','cardinality' => 'many-to-many'),
13 | );
14 |
15 | static function getRegistrationArgs($defaults) {
16 |
17 | $defaults['hierarchical'] = true;
18 |
19 | // Adds menu icon using the $menu_icon property if set
20 | if ( static::$menuIcon ) {
21 | $defaults['menu_icon'] = static::$menuIcon;
22 | }
23 |
24 | return $defaults;
25 | }
26 | }
--------------------------------------------------------------------------------
/Resources/views/Section/team.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% include "OutlandishAcadOowpBundle:Section:title.html.twig" %}
5 |
6 |
7 |
8 |
9 |
10 | {% for item in section.items %}
11 | {% if loop.index <= 3 %}
12 | {% include "OutlandishAcadOowpBundle:Default:item.html.twig" with {'item': item, 'image': 'none'} %}
13 | {% endif %}
14 | {% endfor %}
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Resources/views/Partial/searchResults.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 | {% include 'OutlandishAcadOowpBundle:Partial:items.html.twig'
4 | with { excerpt_length: 120 } %}
5 |
6 |
7 |
8 | {% if search.post_count > 9 and moreResultsUrl %}
9 |
18 | {% endif %}
--------------------------------------------------------------------------------
/PostType/News.php:
--------------------------------------------------------------------------------
1 | array('sortable' => 'any','cardinality' => 'many-to-many'),
12 | 'person' => array('sortable' => 'any','cardinality' => 'many-to-many'),
13 | 'place' => array('sortable' => 'any','cardinality' => 'many-to-many'),
14 | 'project' => array('sortable' => 'any','cardinality' => 'many-to-many'),
15 | 'theme' => array('sortable' => 'any','cardinality' => 'many-to-many'),
16 | );
17 |
18 | public static function friendlyNamePlural(){
19 | return "News";
20 | }
21 |
22 | public function postTypeIcon() {
23 | return self::$menuIcon;
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/Resources/views/Theme/indexAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:indexAbstract.html.twig' %}
2 |
3 | {% block content_main %}
4 |
5 | {{ post.title() | raw }}
6 | {{ post.content() | raw }}
7 |
8 | {% if items | length > 0 %}
9 |
10 |
20 |
21 | {% else %}
22 | No posts could be found.
23 | {% endif %}
24 |
25 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Search/searchSection.html.twig:
--------------------------------------------------------------------------------
1 | {% if not facets %}{% set facets = 'true' %}{% endif %}
2 | {% if resultsMessage == 'false' %}
3 | {% set resultsMessage = '' %}
4 | {% elseif not resultsMessage %}
5 | {% set resultsMessage = 'results for' %}
6 | {% endif %}
7 |
8 | {% block searchResultsContent %}
9 | {% if featuredItem %}
10 | {% block featuredItemContent %}
11 | {% include "OutlandishAcadOowpBundle:Item:featuredItem.html.twig" with {'item': featuredItem} %}
12 | {% endblock %}
13 | {% endif %}
14 | {{ search.found_posts }} {{ resultsMessage }}
15 | {% if search.query_vars.s %}
16 | : '{{ search.query_vars.s }}'
17 | {% endif %}
18 |
19 | {% include "OutlandishAcadOowpBundle:Search:searchResults.html.twig" %}
20 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Theme/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Search:post.html.twig' %}
2 |
3 | {% block content_main %}
4 | Resources related to {{ post.title() }}
5 |
6 | {{ search_form.orderby | raw }}
7 |
8 | {% include 'OutlandishAcadOowpBundle:Partial:searchResults.html.twig' %}
9 |
10 | {% endblock %}
11 |
12 | {% block content_sidebar %}
13 |
14 | {% include "OutlandishAcadOowpBundle:Partial:share.html.twig" with {
15 | 'post': post} %}
16 |
17 | {{ post.title() | raw }}
18 |
19 | {{ post.content() | raw }}
20 |
21 | {{ render(controller('OutlandishAcadOowpBundle:Navigation:renderSideMenu', {
22 | 'maxDepth' : 3,
23 | 'rootPost': post.getRoot()
24 | })) }}
25 |
26 | {% endblock %}
--------------------------------------------------------------------------------
/Controller/DefaultController.php:
--------------------------------------------------------------------------------
1 | querySingle(array('name' => $slugBits[count($slugBits) - 1], 'post_type' => 'any'), true);
24 |
25 | return array(
26 | 'post' => $post,
27 | );
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/FacetedSearch/Facets/FacetPostType.php:
--------------------------------------------------------------------------------
1 | options as $option){
25 | if($option->selected){
26 | $args['post_type'][] = $option->name;
27 | }
28 | }
29 |
30 | return $args;
31 | }
32 |
33 |
34 | }
--------------------------------------------------------------------------------
/Resources/views/Item/featuredItem.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 | {% if featured_heading != 'none' %}
4 |
5 |
6 |
Featured result
7 |
8 |
9 | {% endif %}
10 |
11 |
25 |
26 |
--------------------------------------------------------------------------------
/Resources/views/Search/searchResults.html.twig:
--------------------------------------------------------------------------------
1 | {% if not facets %}{% set facets = 'true' %}{% endif %}
2 | {% if not excerpt_length %}{% set excerpt_length = 200 %}{% endif %}
3 | {% if facets != 'false' %}
4 |
5 | {{ formElements.post_type | raw }}
6 |
7 | {% endif %}
8 |
9 |
10 |
11 | {% include 'OutlandishAcadOowpBundle:Partial:items.html.twig'
12 | with { excerpt_length: excerpt_length } %}
13 |
14 |
15 | {% if search.post_count > 9 %}
16 |
24 | {% endif %}
25 |
--------------------------------------------------------------------------------
/Resources/views/Partial/connected.html.twig:
--------------------------------------------------------------------------------
1 | {% if not classes %}{% set classes = 'main' %}{% endif %}
2 |
3 |
4 | {% for type in connectedItems %}
5 | {% if type.items | length > 0 %}
6 | {% if type.title %}
7 |
{{ type.title | raw }}
8 | {% endif %}
9 |
10 | {% for item in type.items.posts %}
11 |
12 | {% block itemInclude %}
13 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
14 | 'item': item,
15 | 'excerpt_length': 'none',
16 | 'image':'avatar-square',
17 | 'classes' : classes} %}
18 | {% endblock %}
19 |
20 | {% endfor %}
21 |
22 | {% endif %}
23 | {% endfor %}
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Controller/PageController.php:
--------------------------------------------------------------------------------
1 | querySingle(array('page_id' => Page::CONTACT_US_ID));
26 |
27 | $response['post'] = $post;
28 | $response['map'] = $post->contactMap();
29 | $response['address'] = get_field('address', 'options');
30 | $response['contact_people'] = $post->contactPeople();
31 |
32 | return $response;
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/Resources/views/Navigation/topHeader.html.twig:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Resources/views/Partial/social.html.twig:
--------------------------------------------------------------------------------
1 | {% if socialmedia | length > 0 %}
2 | {% for media in socialmedia %}
3 |
4 |
5 | {% if media.url %}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | {% elseif media.email_address %}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | {% endif %}
24 |
25 |
26 | {% endfor %}
27 | {% endif %}
--------------------------------------------------------------------------------
/Resources/views/Section/standard.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% include "OutlandishAcadOowpBundle:Section:title.html.twig" %}
5 |
6 |
7 |
8 |
9 |
10 | {% if not excerpt_length %}{% set excerpt_length = 'none' %}{% endif %}
11 | {% for item in section.items %}
12 | {% if loop.index <= 8 %}
13 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
14 | 'item': item,
15 | 'classes': 'main',
16 | 'image':'item-image-4',
17 | 'tags' : 'none',
18 | 'date' : 'date',
19 | 'excerpt_length': excerpt_length} %}
20 | {% endif %}
21 | {% endfor %}
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Controller/RelatedController.php:
--------------------------------------------------------------------------------
1 | unsetByValue( $types, array( 'person', 'role', 'theme', 'place' ) );
27 |
28 | $connected_types = $post->connectedTypes( $types );
29 |
30 | $items = $post->connected( $connected_types );
31 |
32 | return $this->render(
33 | 'OutlandishAcadOowpBundle:Partial:items.html.twig',
34 | array( 'items' => $items )
35 | );
36 |
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/Resources/public/js/foundation/foundation.alert.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.alert = {
5 | name : 'alert',
6 |
7 | version : '5.1.1',
8 |
9 | settings : {
10 | animation: 'fadeOut',
11 | speed: 300, // fade out speed
12 | callback: function (){}
13 | },
14 |
15 | init : function (scope, method, options) {
16 | this.bindings(method, options);
17 | },
18 |
19 | events : function () {
20 | var self = this,
21 | S = this.S;
22 |
23 | $(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] a.close', function (e) {
24 | var alertBox = S(this).closest('[' + self.attr_name() + ']'),
25 | settings = alertBox.data(self.attr_name(true) + '-init') || self.settings;
26 |
27 | e.preventDefault();
28 | alertBox[settings.animation](settings.speed, function () {
29 | S(this).trigger('closed').remove();
30 | settings.callback();
31 | });
32 | });
33 | },
34 |
35 | reflow : function () {}
36 | };
37 | }(jQuery, this, this.document));
38 |
--------------------------------------------------------------------------------
/Resources/views/Search/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Default:postAbstract.html.twig' %}
2 |
3 | {% block content_main %}
4 |
5 | {# inherits from postAbstract so this just prints out the title and the content #}
6 | {{ parent() }}
7 |
8 | {% include "OutlandishAcadOowpBundle:Partial:connectedResources.html.twig" %}
9 |
10 | {{ render(controller('OutlandishAcadOowpBundle:Search:renderRelatedResources', {
11 | 'post': post,
12 | 'request': request
13 | } )) }}
14 |
15 | {% endblock %}
16 |
17 | {% block content_sidebar %}
18 |
19 | {{ parent() }}
20 | {% for section in related_themes %}
21 |
33 | {% endfor %}
34 |
35 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/404.html.twig:
--------------------------------------------------------------------------------
1 | {% extends '::layout.html.twig' %}
2 |
3 | {% block content %}
4 |
5 | {% if recent_resources | length > 0 %}
6 |
7 | Unfortunately, the page you were looking for was not found. Perhaps these recent Articles may interest you?
8 |
9 |
10 |
11 |
12 | {% for item in recent_resources %}
13 |
14 | {% block itemInclude %}
15 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
16 | 'item': item,
17 | 'excerpt_length': '150',
18 | 'classes' : classes} %}
19 | {% endblock %}
20 |
21 | {% endfor %}
22 |
23 |
24 |
25 |
26 | {% else %}
27 |
28 |
29 |
30 | {% endif %}
31 |
32 | {% endblock %}
--------------------------------------------------------------------------------
/Controller/NewsController.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 | {% if items | length > 0 %}
9 |
10 |
11 |
12 |
13 |
Search Results
14 |
15 | {{ search_form.post_type | raw }}
16 | {{ search_form.orderby | raw }}
17 |
18 | {% include 'OutlandishAcadOowpBundle:Search:searchResults.html.twig' %}
19 |
20 |
21 |
22 | {% elseif sections | length > 0 %}
23 |
24 | {% for section in sections %}
25 | {% include 'OutlandishAcadOowpBundle:Section:' ~ section.layout ~ '.html.twig' %}
26 | {% endfor %}
27 |
28 | {% else %}
29 |
30 | {% block noSearchResults %}
31 | {% include 'OutlandishAcadOowpBundle:Search:noResults.html.twig' with {'post': post } %}
32 | {% endblock %}
33 |
34 | {% endif %}
35 |
36 |
37 |
38 |
39 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Section/largeAndMedium.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% include "OutlandishAcadOowpBundle:Section:title.html.twig" %}
5 |
6 |
7 |
8 |
9 | {% set item = section.items | first %}
10 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
11 | 'item': item,
12 | 'classes': 'main',
13 | 'image': 'item-image-12',
14 | 'tags' : 'post-type'} %}
15 |
16 |
17 | {# if excerpt_length 0, it gets overriden in item.html.twig#}
18 | {% if not excerpt_length %}{% set excerpt_length = 0 %}{% endif %}
19 | {% for item in section.items %}
20 | {% if not loop.first and loop.index <= 4 %}
21 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
22 | 'item': item,
23 | 'classes': '',
24 | 'tags' : 'none',
25 | 'excerpt_length': excerpt_length } %}
26 | {% endif %}
27 | {% endfor %}
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Resources/public/js/foundation/foundation.offcanvas.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.offcanvas = {
5 | name : 'offcanvas',
6 |
7 | version : '5.1.1',
8 |
9 | settings : {},
10 |
11 | init : function (scope, method, options) {
12 | this.events();
13 | },
14 |
15 | events : function () {
16 | var S = this.S;
17 |
18 | S(this.scope).off('.offcanvas')
19 | .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
20 | e.preventDefault();
21 | S(this).closest('.off-canvas-wrap').toggleClass('move-right');
22 | })
23 | .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
24 | e.preventDefault();
25 | S(".off-canvas-wrap").removeClass("move-right");
26 | })
27 | .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
28 | e.preventDefault();
29 | S(this).closest(".off-canvas-wrap").toggleClass("move-left");
30 | })
31 | .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
32 | e.preventDefault();
33 | S(".off-canvas-wrap").removeClass("move-left");
34 | });
35 | },
36 |
37 | reflow : function () {}
38 | };
39 | }(jQuery, this, this.document));
40 |
--------------------------------------------------------------------------------
/Resources/views/Event/indexAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:indexAbstract.html.twig' %}
2 |
3 | {% block content_main_results %}
4 |
5 | {% include 'OutlandishAcadOowpBundle:Partial:searchResults.html.twig' %}
6 |
7 | {% endblock %}
8 |
9 | {% block content_main_no_results %}
10 |
11 | Upcoming Events
12 | There are currently no upcoming events.
13 |
14 | {% if past_items | length > 0 %}
15 |
16 | See below for some recent events.
17 |
18 | {% include 'OutlandishAcadOowpBundle:Partial:searchResults.html.twig' with {
19 | 'items': past_items} %}
20 |
21 | {% endif %}
22 |
23 | {% endblock %}
24 |
25 | {% block content_sidebar %}
26 |
27 | {{ parent() }}
28 |
29 | {% if past_items | length > 0 %}
30 |
31 |
41 |
42 | {% endif %}
43 |
44 | {% endblock %}
--------------------------------------------------------------------------------
/Controller/PlaceController.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% include "OutlandishAcadOowpBundle:Section:title.html.twig" %}
5 |
6 |
7 | {% set item = section.items | first %}
8 | {% include "OutlandishAcadOowpBundle:Item:featuredItem.html.twig" with {'featured_heading' : 'none' } %}
9 |
10 |
11 |
12 | {% if not excerpt_length %}{% set excerpt_length = 150 %}{% endif %}
13 | {% for item in section.items %}
14 | {% if not loop.first and loop.index <= 4 %}
15 |
16 |
17 | {% include "OutlandishAcadOowpBundle:Default:item.html.twig" with {
18 | 'item': item,
19 | 'image': 'none',
20 | 'tags' : 'none',
21 | 'date' : 'date',
22 | 'excerpt_length': 120
23 | } %}
24 |
25 | {% endif %}
26 | {% endfor %}
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Controller/ProjectController.php:
--------------------------------------------------------------------------------
1 | n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0!==a.cookie(b)?(a.cookie(b,"",a.extend({},c,{expires:-1})),!0):!1}});
9 |
--------------------------------------------------------------------------------
/Resources/views/Person/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% if size is not defined %}
2 | {% set size = 'normal' %}
3 | {% endif %}
4 |
5 | {% if size == 'small' %}
6 |
7 |
8 | {% include "OutlandishAcadOowpBundle:Person:avatar.html.twig" with {
9 | 'post': item,
10 | 'size': 'avatar-square' } %}
11 | {{ item.title() | raw }}
12 |
13 | {% else %}
14 |
15 |
16 |
17 |
18 | {% block item_image %}{{ item.featuredImage('large') | raw }}{% endblock %}
19 | {% if 'image-overlay' in classes %}
20 |
{{ item.dateString("j M Y", true) | raw }}
21 | {% endif %}
22 |
23 |
24 |
25 | {% block item_title %}
{{ item.title() | raw }} {% endblock %}
26 | {% block item_content %}
{{ item.excerpt(200) | raw }}
{% endblock %}
27 |
28 |
29 |
30 | {% endif %}
31 |
32 |
--------------------------------------------------------------------------------
/Resources/public/js/foundation/jquery.cookie.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery Cookie Plugin v1.4.0
3 | * https://github.com/carhartl/jquery-cookie
4 | *
5 | * Copyright 2013 Klaus Hartl
6 | * Released under the MIT license
7 | */
8 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{a=decodeURIComponent(a.replace(g," "))}catch(b){return}try{return h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setDate(k.getDate()+j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0!==a.cookie(b)?(a.cookie(b,"",a.extend({},c,{expires:-1})),!0):!1}});
9 |
--------------------------------------------------------------------------------
/EventListener/NotFoundListener.php:
--------------------------------------------------------------------------------
1 | templateEngine = $templateEngine;
19 | }
20 |
21 | public function onKernelException(GetResponseForExceptionEvent $event) {
22 | if ($event->getException() instanceof NotFoundHttpException) {
23 |
24 | // replace the global post with a fake one, and show a 404 template
25 | global $post, $wp_query;
26 | $post = new FakePost();
27 | $wp_query->post = $post;
28 | $wp_query->is_404 = true;
29 |
30 | $content = $this->templateEngine->render(
31 | 'OutlandishAcadOowpBundle::404.html.twig',
32 | array(
33 | 'post'=> $post,
34 | 'recent_resources' => Post::fetchAll(array(
35 | 'post_type' =>
36 | array(
37 | 'news',
38 | 'event',
39 | 'document'
40 | ),
41 | 'posts_per_page' => 5))));
42 |
43 | $event->setResponse(new Response($content));
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/Resources/views/Section/largeAndSmall.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% include "OutlandishAcadOowpBundle:Section:title.html.twig" %}
5 |
6 |
7 |
8 |
9 | {% set item = section.items | first %}
10 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
11 | 'item': item,
12 | 'classes': 'main',
13 | 'image' : 'item-image-12',
14 | 'tags' : 'post-type'} %}
15 |
16 |
17 |
18 | {# if excerpt_length 0, it gets overriden in item.html.twig#}
19 | {% if not excerpt_length %}{% set excerpt_length = 0 %}{% endif %}
20 | {% for item in section.items %}
21 | {% if not loop.first and loop.index <= 3 %}
22 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
23 | 'item': item,
24 | 'classes': 'main',
25 | 'image':'large',
26 | 'tags' : 'none',
27 | 'excerpt_length': excerpt_length} %}
28 | {% endif %}
29 | {% endfor %}
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Resources/views/Section/featuredAndSmall.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% include "OutlandishAcadOowpBundle:Section:title.html.twig" %}
5 |
6 |
7 | {% set item = section.items | first %}
8 |
9 |
10 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
11 | 'item': item,
12 | 'classes': '',
13 | 'tags' : 'none',
14 | 'excerpt_length': 600 } %}
15 |
16 |
17 |
18 |
19 |
20 | {% for item in section.items %}
21 | {% if not loop.first and loop.index <= 7 %}
22 |
23 |
24 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
25 | 'item': item,
26 | 'classes': 'main',
27 | 'image' : 'item-image-12',
28 | 'tags' : '',
29 | 'excerpt_length': 'none' } %}
30 |
31 | {% endif %}
32 | {% endfor %}
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Resources/views/Search/indexAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Default:postAbstract.html.twig' %}
2 |
3 | {% block content_main %}
4 |
5 | {# inherits from postAbstract so this just prints out the title and the content #}
6 | {{ parent() }}
7 |
8 | {% if items | length > 0 %}
9 |
10 | {% block content_main_results %}
11 | {% if featuredItem %}
12 |
13 | {% if not featured_heading %}{% set featured_heading = '' %}{% endif %}
14 |
15 | {% block featuredItemContent %}
16 | {% include "OutlandishAcadOowpBundle:Item:featuredItem.html.twig" with {
17 | 'item': featuredItem,
18 | 'featured_heading' : featured_heading
19 | } %}
20 | {% endblock %}
21 |
22 | {% endif %}
23 |
24 | {{ search_form.orderby | raw }}
25 | {#{{ search_form.order | raw }}#}
26 |
27 | {% include 'OutlandishAcadOowpBundle:Partial:searchResults.html.twig' %}
28 | {% endblock %}
29 |
30 | {% elseif sections | length > 0 %}
31 |
32 | {% for section in sections %}
33 | {% include 'OutlandishAcadOowpBundle:Section:' ~ section.layout ~ '.html.twig' %}
34 | {% endfor %}
35 |
36 | {% else %}
37 |
38 | {% block content_main_no_results %}
39 | {% include 'OutlandishAcadOowpBundle:Search:noResults.html.twig' %}
40 | {% endblock %}
41 |
42 | {% endif %}
43 |
44 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Event/event.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% if post.dateString or post.address or latitude %}
6 |
7 |
Event details
8 |
9 | {% if post.endDateString() %}
10 |
Start date: {{ post.startDateString("j F Y") | raw }}
11 |
End date: {{ post.endDateString() | raw }}
12 | {% elseif post.dateString() %}
13 |
Date: {{ post.startDateString("j F Y") | raw }}
14 | {% endif %}
15 |
16 | {% if post.startTime() %}
17 |
Time: {{ post.startTime() | raw }}
18 | {% endif %}
19 |
20 | {% if post.address() %}
21 |
Location: {{ post.address() | raw }}
22 | {% endif %}
23 |
24 | {% if latitude | length > 0 and longitude | length > 0 %}
25 |
28 | {% else %}
29 |
30 | {% endif %}
31 |
32 | {% endif %}
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Resources/views/Default/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends '::layout.html.twig' %}
2 |
3 | {% block title %}{{ post.title() | raw }}{% endblock %}
4 |
5 | {% block content %}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | {% block content_main %}
15 |
{{ post.title() | raw }}
16 | {{ post.featuredImage('item-image-12') | raw}}
17 |
18 | {{ post.content() | raw }}
19 | {% endblock %}
20 |
21 |
22 |
23 |
24 |
25 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Partial/socialDropdown.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
36 |
--------------------------------------------------------------------------------
/Controller/DocumentController.php:
--------------------------------------------------------------------------------
1 | documentUrl();
36 | $response['attachment'] = $response['post']->attachment();
37 | return $response;
38 | }
39 |
40 | protected function getIndexPageId()
41 | {
42 | return Document::postTypeParentId();
43 | }
44 |
45 | protected function getSearchResultPostTypes()
46 | {
47 | return array(Document::postType());
48 | }
49 |
50 | public function postTypes()
51 | {
52 | return array(Document::postType());
53 | }
54 | }
--------------------------------------------------------------------------------
/Resources/views/Item/itemContent.html.twig:
--------------------------------------------------------------------------------
1 | {% if excerpt_length == 'none' %}{% set excerpt_length = 0 %}{% endif %}
2 |
3 | {% block item_subtitle %}
4 | {% if date != 'none' %}
5 | {{ item.dateString("j M Y", true) | raw }}
6 | {% endif %}
7 | {% endblock %}
8 |
9 | {% block item_title %}
10 | {{ item.title() | raw }}
11 | {% if 'side-items' in classes and item.postType() == 'person' %}
12 | {{ item.role() }}
13 | {% endif %}
14 | {% endblock %}
15 |
16 | {#{% if 'side-items' not in classes and tags != 'none' %}#}
17 |
18 | {#{% block item_type %}#}
19 | {#{% if item.postTypeIcon() %}#}
20 | {# #}
21 | {#{% endif %}#}
22 | {#{{ item.friendlyName() }}
#}
23 | {#{% endblock %}#}
24 |
25 | {#{% endif %}#}
26 |
27 | {% block item_content %}
28 | {% if excerpt_length != 0 %}
29 | {{ item.excerpt(excerpt_length) | raw }}
30 | {% endif %}
31 | {% endblock %}
32 |
33 | {#{% if 'side-items' not in classes and tags != 'none' and tags != 'post-type' %}#}
34 |
35 | {#{% block item_authors %}#}
36 | {#{% if item.hasAuthors() %}#}
37 | {# {{ item.authorTitles() | join(', ') }}
#}
38 | {#{% endif %}#}
39 | {#{% endblock %}#}
40 |
41 | {#{% block item_themes %}#}
42 | {#{% if item.hasThemes() %}#}
43 | {# {{ item.themeTitles() | join(', ') }}
#}
44 | {#{% endif %}#}
45 | {#{% endblock %}#}
46 |
47 | {#{% endif %}#}
--------------------------------------------------------------------------------
/Resources/views/Menu/menuItems.html.twig:
--------------------------------------------------------------------------------
1 | {% if parent_post is defined and posts.posts | length > 1 %}
2 | Find out more
3 | {% set tempMenuArgs = {'max_depth': 1, 'current_depth': 1} %}
4 | {% include "OutlandishOowpBundle:Helper:menuItem.html.twig" with { post: parent_post, queryArgs: queryArgs, menuArgs: tempMenuArgs } %}
5 | {% endif %}
6 |
7 | {% for post in posts %}
8 | {% include "OutlandishOowpBundle:Helper:menuItem.html.twig" with { post: post, queryArgs: queryArgs, menuArgs: menuArgs } %}
9 | {% endfor %}
10 |
11 | {% if social_media | length > 0 %}
12 |
13 |
14 |
29 |
30 | {% endif %}
31 |
32 | {% if search_button %}
33 |
34 |
35 | {% if search_button_text %}
36 | {{ search_button_text }}
37 | {% endif %}
38 |
39 |
40 |
41 | {% endif %}
--------------------------------------------------------------------------------
/FacetedSearch/FacetOption/FacetOption.php:
--------------------------------------------------------------------------------
1 | setName($name);
37 | $this->setLabel($label);
38 | $this->setSelected($selected);
39 | }
40 |
41 | /**
42 | * @return null
43 | */
44 | public function getLabel()
45 | {
46 | return $this->label;
47 | }
48 |
49 | /**
50 | * @param null $label
51 | */
52 | public function setLabel($label)
53 | {
54 | $this->label = $label;
55 | }
56 |
57 | /**
58 | * @return null
59 | */
60 | public function getName()
61 | {
62 | return $this->name;
63 | }
64 |
65 | /**
66 | * @param null $name
67 | */
68 | public function setName($name)
69 | {
70 | $this->name = $name;
71 | }
72 |
73 | /**
74 | * @return boolean
75 | */
76 | public function isSelected()
77 | {
78 | return $this->selected;
79 | }
80 |
81 | /**
82 | * @param boolean $selected
83 | */
84 | public function setSelected($selected)
85 | {
86 | $this->selected = $selected;
87 | }
88 |
89 | }
--------------------------------------------------------------------------------
/Resources/public/js/foundation/foundation.accordion.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.accordion = {
5 | name : 'accordion',
6 |
7 | version : '5.1.1',
8 |
9 | settings : {
10 | active_class: 'active',
11 | toggleable: true
12 | },
13 |
14 | init : function (scope, method, options) {
15 | this.bindings(method, options);
16 | },
17 |
18 | events : function () {
19 | var self = this;
20 | var S = this.S;
21 | S(this.scope)
22 | .off('.fndtn.accordion')
23 | .on('click.fndtn.accordion', '[' + this.attr_name() + '] > dd > a', function (e) {
24 | var accordion = S(this).closest('[' + self.attr_name() + ']'),
25 | target = S('#' + this.href.split('#')[1]),
26 | siblings = S('dd > .content', accordion),
27 | aunts = $('> dd', accordion),
28 | settings = accordion.data(self.attr_name(true) + '-init'),
29 | active_content = S('dd > .content.' + settings.active_class, accordion),
30 | active_parent = S('dd.' + settings.active_class, accordion);
31 |
32 | e.preventDefault();
33 |
34 | if (active_content[0] == target[0] && settings.toggleable) {
35 | active_parent.toggleClass(settings.active_class, false);
36 | return target.toggleClass(settings.active_class, false);
37 | }
38 |
39 | siblings.removeClass(settings.active_class);
40 | aunts.removeClass(settings.active_class);
41 | target.addClass(settings.active_class).parent().addClass(settings.active_class);
42 | });
43 | },
44 |
45 | off : function () {},
46 |
47 | reflow : function () {}
48 | };
49 | }(jQuery, this, this.document));
50 |
--------------------------------------------------------------------------------
/Tests/Controller/PageControllerTest.php:
--------------------------------------------------------------------------------
1 | "127.0.0.1"
27 | ));
28 |
29 | $_SERVER['REQUEST_URI'] = "/scaca/web/about-isci/contact-us/";
30 | $crawler = $client->request(
31 | 'GET',
32 | '/scaca/web/about-isci/contact-us/');
33 |
34 | $this->assertEquals(1, $crawler->filter('h1')->count(), "Too many page titles (h1)");
35 | $this->assertEquals(1, $crawler->filter('.content-sidebar')->count(), "Not Enough Sidebars or too many");
36 | $sideMenu = $crawler->filter('.side-menu');
37 | $this->assertLessThanOrEqual(1, $sideMenu->count(), "Too many side menus");
38 | if($sideMenu->count() == 1){
39 | $li = $sideMenu->filter('li.current_page_item');
40 | $this->assertEquals(1, $li->count(), "No entry in side menu for current page");
41 | $this->assertEquals($client->getRequest()->getUri(), $li->filter('a')->attr('href'), "Current Page link does not match current page");
42 | }
43 | $this->assertLessThanOrEqual(1, $crawler->filter('.google-map')->count());
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Tests/Controller/DefaultControllerTest.php:
--------------------------------------------------------------------------------
1 | "127.0.0.1"
27 | ));
28 |
29 | $_SERVER['REQUEST_URI'] = "/scaca/web/about-isci/";
30 | $crawler = $client->request(
31 | 'GET',
32 | '/scaca/web/about-isci/',
33 | array(),
34 | array(),
35 | array(
36 | "REQUEST_URI" => "/scaca/web/about-isci/"
37 | ));
38 |
39 | $this->assertEquals(1, $crawler->filter('h1')->count(), "Too many page titles (h1)");
40 | $this->assertEquals(1, $crawler->filter('.content-sidebar')->count(), "Too many sidebars");
41 | $sideMenu = $crawler->filter('.side-menu');
42 | $this->assertLessThanOrEqual(1, $sideMenu->count(), "Too many side menus");
43 | if($sideMenu->count() == 1){
44 | $li = $sideMenu->filter('li.current_page_item');
45 | $this->assertEquals(1, $li->count(), "No entry in side menu for current page");
46 | $this->assertEquals($client->getRequest()->getUri(), $li->filter('a')->attr('href'), "Current Page link does not match current page");
47 | }
48 |
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Controller/CarouselController.php:
--------------------------------------------------------------------------------
1 | getCarousel();
14 |
15 | return $this->render(
16 | 'OutlandishAcadOowpBundle:Carousel:carousel.html.twig',
17 | $args
18 | );
19 | }
20 |
21 | public function getCarousel( $args = array() )
22 | {
23 | $supportingOrganisation = get_field('qmul_image', 'options');
24 | $supportingText = get_field('qmul_text', 'options');
25 | $supportingLink = get_field('qmul_link', 'options');
26 |
27 | $organisations = get_field('associated_organisations', 'options');
28 | $carouselOrganisations = array();
29 | if(is_array($organisations)){
30 | foreach ($organisations as $org) {
31 | $org['url'] = $this->cleanUrl($org['url']);
32 | $org['logo'] = $this->getImageWithId($org['logo'], 'medium');
33 | $carouselOrganisations[] = $org;
34 | }
35 | }
36 |
37 | $args['supporting_image'] = $supportingOrganisation;
38 | $args['supporting_text'] = $supportingText;
39 | $args['supporting_link'] = $supportingLink;
40 | $args['carousel_organisations'] = $carouselOrganisations;
41 |
42 | return $args;
43 | }
44 |
45 | public function cleanUrl($url) {
46 |
47 | if($url == "" || $url == "http://" ) return null;
48 |
49 | return preg_replace('%^(?!https?://)(.*)%', 'http://$1', $url);
50 | }
51 |
52 | public function getImageWithId($id, $image_size = 'thumbnail'){
53 | $image = wp_get_attachment_image_src($id, $image_size);
54 | return $image[0];
55 | }
56 | }
--------------------------------------------------------------------------------
/Resources/public/js/foundation/foundation.tab.js:
--------------------------------------------------------------------------------
1 | /*jslint unparam: true, browser: true, indent: 2 */
2 | ;(function ($, window, document, undefined) {
3 | 'use strict';
4 |
5 | Foundation.libs.tab = {
6 | name : 'tab',
7 |
8 | version : '5.1.1',
9 |
10 | settings : {
11 | active_class: 'active',
12 | callback : function () {}
13 | },
14 |
15 | init : function (scope, method, options) {
16 | this.bindings(method, options);
17 | },
18 |
19 | events : function () {
20 | var self = this,
21 | S = this.S;
22 |
23 | S(this.scope).off('.tab').on('click.fndtn.tab', '[' + this.attr_name() + '] > dd > a', function (e) {
24 | e.preventDefault();
25 | e.stopPropagation();
26 |
27 | var tab = S(this).parent(),
28 | tabs = tab.closest('[' + self.attr_name() + ']'),
29 | target = S('#' + this.href.split('#')[1]),
30 | siblings = tab.siblings(),
31 | settings = tabs.data(self.attr_name(true) + '-init');
32 |
33 | // allow usage of data-tab-content attribute instead of href
34 | if (S(this).data(self.data_attr('tab-content'))) {
35 | target = S('#' + S(this).data(self.data_attr('tab-content')).split('#')[1]);
36 | }
37 |
38 | tab.addClass(settings.active_class).triggerHandler('opened');
39 | siblings.removeClass(settings.active_class);
40 | target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
41 | settings.callback(tab);
42 | tabs.triggerHandler('toggled', [tab]);
43 | });
44 | },
45 |
46 | data_attr: function (str) {
47 | if (this.namespace.length > 0) {
48 | return this.namespace + '-' + str;
49 | }
50 |
51 | return str;
52 | },
53 |
54 | off : function () {},
55 |
56 | reflow : function () {}
57 | };
58 | }(jQuery, this, this.document));
59 |
--------------------------------------------------------------------------------
/FacetedSearch/Facets/FacetOrder.php:
--------------------------------------------------------------------------------
1 | self::SORT_DESC_NAME,
26 | self::SORT_ASC => self::SORT_ASC_NAME,
27 | );
28 |
29 | function __construct($name, $section, $options = array())
30 | {
31 | parent::__construct($name, $section, $options);
32 | if(empty($this->options)){
33 | foreach($this->defaultOptions as $name => $label){
34 | $option = new FacetOption($name, $label);
35 | $this->addOption($option);
36 | }
37 | }
38 | }
39 |
40 | /**
41 | * @param array $args
42 | * @return array
43 | */
44 | public function generateArguments($args = array())
45 | {
46 | $args = parent::generateArguments($args);
47 |
48 | //foreach option that is selected insert option as post_type
49 | $option = array_values($this->getSelectedOptions());
50 | $args['order'] = $option[0]->name;
51 |
52 | return $args;
53 | }
54 |
55 | public function setSelected(array $params)
56 | {
57 | $affected = parent::setSelected($params);
58 | if ($affected == 0) {
59 | $optionKeys = array_keys($this->options);
60 | $this->options[$optionKeys[0]]->selected = true;
61 | $affected++;
62 | }
63 | return $affected;
64 | }
65 |
66 |
67 | }
--------------------------------------------------------------------------------
/PostType/Person.php:
--------------------------------------------------------------------------------
1 | array('sortable' => 'any','cardinality' => 'many-to-many'),
14 | 'project' => array('sortable' => 'any','cardinality' => 'many-to-many'),
15 | 'theme' => array('sortable' => 'any','cardinality' => 'many-to-many'),
16 | );
17 |
18 | static function getRegistrationArgs($defaults) {
19 |
20 | $defaults['hierarchical'] = true;
21 |
22 | // Adds menu icon using the $menu_icon property if set
23 | if ( static::$menuIcon ) {
24 | $defaults['menu_icon'] = static::$menuIcon;
25 | }
26 |
27 | return $defaults;
28 | }
29 |
30 | public static function friendlyNamePlural(){
31 | return "People";
32 | }
33 |
34 | /**
35 | * @param $userId
36 | * @return void|Person
37 | */
38 | public static function fetchByUser($userId)
39 | {
40 | $user = new \WP_User($userId);
41 | $connectionName = self::getConnectionName('user');
42 | return self::fetchOne(array(
43 | 'connected_type' => $connectionName,
44 | 'connected_items' => $user
45 | ));
46 | }
47 |
48 | /**
49 | * Get the role for th person
50 | *
51 | * @return mixed|string|void
52 | */
53 | public function role() {
54 | $role = $this->connected( Role::postType(), true );
55 |
56 | return ( $role ) ? $role->title() : '';
57 | }
58 | /**
59 | * @return string
60 | */
61 | public function email()
62 | {
63 | return $this->metadata('email');
64 | }
65 |
66 | /**
67 | * @return string
68 | */
69 | public function phone()
70 | {
71 | return $this->metadata('tel');
72 | }
73 |
74 | }
--------------------------------------------------------------------------------
/Resources/public/js/foundation/foundation.equalizer.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.equalizer = {
5 | name : 'equalizer',
6 |
7 | version : '5.1.1',
8 |
9 | settings : {
10 | use_tallest: true,
11 | before_height_change: $.noop,
12 | after_height_change: $.noop
13 | },
14 |
15 | init : function (scope, method, options) {
16 | this.bindings(method, options);
17 | this.reflow();
18 | },
19 |
20 | events : function () {
21 | this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){
22 | this.reflow();
23 | }.bind(this));
24 | },
25 |
26 | equalize: function(equalizer) {
27 | var isStacked = false,
28 | vals = equalizer.find('[' + this.attr_name() + '-watch]'),
29 | firstTopOffset = vals.first().offset().top,
30 | settings = equalizer.data(this.attr_name(true)+'-init');
31 |
32 | if (vals.length === 0) return;
33 | settings.before_height_change();
34 | equalizer.trigger('before-height-change');
35 | vals.height('inherit');
36 | vals.each(function(){
37 | var el = $(this);
38 | if (el.offset().top !== firstTopOffset) {
39 | isStacked = true;
40 | }
41 | });
42 | if (isStacked) return;
43 |
44 | var heights = vals.map(function(){ return $(this).outerHeight() });
45 | if (settings.use_tallest) {
46 | var max = Math.max.apply(null, heights);
47 | vals.height(max);
48 | } else {
49 | var min = Math.min.apply(null, heights);
50 | vals.height(min);
51 | }
52 | settings.after_height_change();
53 | equalizer.trigger('after-height-change');
54 | },
55 |
56 | reflow : function () {
57 | var self = this;
58 |
59 | this.S('[' + this.attr_name() + ']', this.scope).each(function(){
60 | self.equalize($(this));
61 | });
62 | }
63 | };
64 | }(jQuery, this, this.document));
65 |
--------------------------------------------------------------------------------
/Resources/views/Partial/share.html.twig:
--------------------------------------------------------------------------------
1 |
36 |
--------------------------------------------------------------------------------
/Controller/PersonController.php:
--------------------------------------------------------------------------------
1 | querySingle(array(
25 | 'page_id' => $this->getIndexPageId(),
26 | 'post_type' => Page::postType()
27 | ));
28 |
29 | $roles = Role::fetchAll();
30 |
31 | if ( $roles->post_count > 0 ) {
32 | foreach ( $roles as $role ) {
33 | $role->people = $role->connected( Person::postType() );
34 | }
35 | $people = array();
36 | } else {
37 | $people = Person::fetchAll()->posts;
38 | }
39 |
40 | return array(
41 | 'post' => $post,
42 | 'roles' => $roles->posts,
43 | 'people' => $people
44 | );
45 | }
46 |
47 | /**
48 | * @param Request $request
49 | * @param mixed $name
50 | * @return array
51 | *
52 | * @Template("OutlandishAcadOowpBundle:Person:post.html.twig")
53 | */
54 | public function singleAction(Request $request, $name) {
55 | return parent::singleAction($request, $name);
56 | }
57 |
58 | protected function getIndexPageId()
59 | {
60 | return Person::postTypeParentId();
61 | }
62 |
63 | protected function getSearchResultPostTypes()
64 | {
65 | return array(Person::postType());
66 | }
67 |
68 | public function postTypes()
69 | {
70 | return array(Person::postType());
71 | }
72 |
73 |
74 | }
--------------------------------------------------------------------------------
/Controller/ThemeController.php:
--------------------------------------------------------------------------------
1 | querySingle(array(
23 | 'page_id' => $this->getIndexPageId(),
24 | 'post_type' => Page::postType()
25 | ), true);
26 |
27 | $class = $this->getClass();
28 | $items = $class::fetchAll(array('orderby' => 'title', 'order' => 'ASC'))->posts;
29 |
30 | return array(
31 | 'post' => $post,
32 | 'items' => $items
33 | );
34 | }
35 |
36 | /**
37 | * @param Request $request
38 | * @param mixed $name
39 | * @return array
40 | *
41 | * @Template("OutlandishAcadOowpBundle:Theme:post.html.twig")
42 | */
43 | public function singleAction(Request $request, $name) {
44 | $resources = parent::singleAction($request, $name);
45 | $class = $this->getClass();
46 | $request->query->set($class::postType(), array($resources['post']->ID));
47 | return array_merge($resources, $this->processSearch($request));
48 | }
49 |
50 | protected function getIndexPageId()
51 | {
52 | return Theme::postTypeParentId();
53 | }
54 |
55 | protected function getSearchResultPostTypes()
56 | {
57 | return array(Theme::postType());
58 | }
59 |
60 | public function postTypes()
61 | {
62 | return array(Theme::postType());
63 | }
64 |
65 | public function getClass()
66 | {
67 | return $this->class;
68 | }
69 | }
--------------------------------------------------------------------------------
/Resources/public/js/vendor/placeholder.js:
--------------------------------------------------------------------------------
1 | /*! http://mths.be/placeholder v2.0.7 by @mathias */
2 | !function(a,b,c){function d(a){var b={},d=/^jQuery\d+$/;return c.each(a.attributes,function(a,c){c.specified&&!d.test(c.name)&&(b[c.name]=c.value)}),b}function e(a,d){var e=this,f=c(e);if(e.value==f.attr("placeholder")&&f.hasClass("placeholder"))if(f.data("placeholder-password")){if(f=f.hide().next().show().attr("id",f.removeAttr("id").data("placeholder-id")),a===!0)return f[0].value=d;f.focus()}else e.value="",f.removeClass("placeholder"),e==b.activeElement&&e.select()}function f(){var a,b=this,f=c(b),g=this.id;if(""==b.value){if("password"==b.type){if(!f.data("placeholder-textinput")){try{a=f.clone().attr({type:"text"})}catch(h){a=c(" ").attr(c.extend(d(this),{type:"text"}))}a.removeAttr("name").data({"placeholder-password":!0,"placeholder-id":g}).bind("focus.placeholder",e),f.data({"placeholder-textinput":a,"placeholder-id":g}).before(a)}f=f.removeAttr("id").hide().prev().attr("id",g).show()}f.addClass("placeholder"),f[0].value=f.attr("placeholder")}else f.removeClass("placeholder")}var g,h,i="placeholder"in b.createElement("input"),j="placeholder"in b.createElement("textarea"),k=c.fn,l=c.valHooks;i&&j?(h=k.placeholder=function(){return this},h.input=h.textarea=!0):(h=k.placeholder=function(){var a=this;return a.filter((i?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":e,"blur.placeholder":f}).data("placeholder-enabled",!0).trigger("blur.placeholder"),a},h.input=i,h.textarea=j,g={get:function(a){var b=c(a);return b.data("placeholder-enabled")&&b.hasClass("placeholder")?"":a.value},set:function(a,d){var g=c(a);return g.data("placeholder-enabled")?(""==d?(a.value=d,a!=b.activeElement&&f.call(a)):g.hasClass("placeholder")?e.call(a,!0,d)||(a.value=d):a.value=d,g):a.value=d}},i||(l.input=g),j||(l.textarea=g),c(function(){c(b).delegate("form","submit.placeholder",function(){var a=c(".placeholder",this).each(e);setTimeout(function(){a.each(f)},10)})}),c(a).bind("beforeunload.placeholder",function(){c(".placeholder").each(function(){this.value=""})}))}(this,document,jQuery);
3 |
--------------------------------------------------------------------------------
/Resources/views/Page/pageContact.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Page:postAbstract.html.twig' %}
2 |
3 | {% block content_main %}
4 |
5 | {{ post.title() | raw }}
6 |
7 | {% if map | length > 0 %}
8 |
9 |
12 |
13 | {{ post.content() | raw }}
14 |
15 | Address
16 |
17 |
18 | {{ address | raw }}
19 |
20 |
21 | {% else %}
22 |
23 | {{ post.content() | raw }}
24 |
25 | {% endif %}
26 |
27 | {% if contact_people | length > 0 %}
28 |
29 | Contacts
30 |
31 |
32 |
33 | {% for person in contact_people %}
34 |
35 |
36 | {% if person.name.content | length > 0 %}
37 |
38 | {{ person.name.prefix }}
39 | {{ person.name.content }}
40 | {{ person.name.suffix }}
41 |
42 | {% endif %}
43 |
44 | {% if person.phone.content | length > 0 %}
45 | {{ person.phone.content }}
46 | {% endif %}
47 | {% if person.email.content | length > 0 %}
48 | {{ person.email.content }}
49 | {% endif %}
50 |
51 |
52 |
53 | {% endfor %}
54 |
55 |
56 | {% endif %}
57 |
58 | {% endblock %}
59 |
60 | {% block footer %}
61 | {{ parent() }}
62 |
63 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Section/largeGrid.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% include "OutlandishAcadOowpBundle:Section:title.html.twig" %}
5 |
6 |
7 |
8 |
9 |
10 | {% set classes = '' %}
11 | {% set image = 'item-image-12' %}
12 |
13 | {% for item in section.items %}
14 |
15 | {#limit to 18 items#}
16 | {% if loop.index <= 18 %}
17 |
18 | {#display items 1-2 with excerpt and items 1-6 with images#}
19 | {% if loop.index > 2 and loop.index <= 6 %}
20 | {% set excerpt_length = 'none' %}
21 | {% set classes = 'main' %}
22 | {% set image = 'item-image-6' %}
23 | {% else %}
24 | {% set image = 'none' %}
25 | {% endif %}
26 |
27 | {#display items 1-2 at 50% width by showing image in separate li#}
28 | {% if loop.index <= 2 %}
29 |
30 | {{ item.featuredImage('item-image-12') | raw }}
31 |
32 | {% set excerpt_length = 80 %}
33 | {% endif %}
34 |
35 | {% include 'OutlandishAcadOowpBundle:Default:item.html.twig' with {
36 | 'item': item,
37 | 'classes': classes,
38 | 'image': image,
39 | 'date' : 'date',
40 | 'tags' : 'none',
41 | 'excerpt_length': excerpt_length} %}
42 |
43 | {% endif %}
44 |
45 | {% endfor %}
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Resources/views/Search/filterPanel.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
11 |
12 |
13 |
14 |
15 | {% for facet in facets %}
16 |
17 |
18 |
Browse by {{ facet.section | lower | raw }}
19 |
34 |
35 | {% endfor %}
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/FacetedSearch/Facets/FacetOrderBy.php:
--------------------------------------------------------------------------------
1 | self::SORT_RELEVANCE_LABEL,
30 | self::SORT_DATE => self::SORT_DATE_LABEL,
31 | self::SORT_TITLE => self::SORT_TITLE_LABEL,
32 | // self::SORT_POPULARITY => self::SORT_POPULARITY_LABEL,
33 | );
34 |
35 | function __construct($name, $section, $options = array())
36 | {
37 | parent::__construct($name, $section, $options);
38 | if(empty($this->options)){
39 | foreach($this->defaultOptions as $name => $label){
40 | $option = new FacetOption($name, $label);
41 | $this->addOption($option);
42 | }
43 | }
44 | }
45 |
46 | /**
47 | * @param array $args
48 | * @return array
49 | */
50 | public function generateArguments($args = array())
51 | {
52 | $args = parent::generateArguments($args);
53 |
54 | //foreach option that is selected insert option as post_type
55 | $option = array_values($this->getSelectedOptions());
56 | $args['orderby'] = $option[0]->name;
57 |
58 | return $args;
59 | }
60 |
61 | public function setSelected(array $params)
62 | {
63 | $affected = parent::setSelected($params);
64 | if ($affected == 0) {
65 | $optionKeys = array_keys($this->options);
66 | $this->options[$optionKeys[0]]->selected = true;
67 | $affected++;
68 | }
69 | return $affected;
70 | }
71 |
72 | }
--------------------------------------------------------------------------------
/Resources/views/Carousel/carousel.html.twig:
--------------------------------------------------------------------------------
1 | {% if carousel_organisations | length > 0 %}
2 | {% block carousel_organisations %}
3 |
45 |
46 |
47 |
48 | {% endblock %}
49 | {% endif %}
50 |
51 |
--------------------------------------------------------------------------------
/Resources/views/Default/itemAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% if not image %}{% set image = "large" %}{% endif %}
2 | {% if not tags %}{% set tags = "tags" %}{% endif %}
3 | {% if not date %}{% set date = "none" %}{% endif %}
4 | {% if not excerpt_length %}{% set excerpt_length = 400 %}{% endif %}
5 |
6 | {% if (image == 'none' or not item.featuredImage()) %}
7 |
8 |
9 | {% block itemNoImageInclude %}
10 | {% include 'OutlandishAcadOowpBundle:Item:itemContent.html.twig' with {
11 | 'item': item,
12 | 'excerpt_length': excerpt_length,
13 | 'date' : date,
14 | 'tags' : tags
15 | } %}
16 | {% endblock %}
17 |
18 |
19 | {% else %}
20 |
21 |
22 |
23 |
24 | {% block item_image %}
25 |
26 | {% if item.featuredImage() %}
27 |
28 | {{ item.featuredImage(image) | raw }}
29 |
30 | {% elseif item.postType() == 'person' %}
31 |
32 |
33 |
34 | {% endif %}
35 |
36 | {% endblock %}
37 | {% if 'image-overlay' in classes %}
38 |
{{ item.dateString("j M Y", true) | raw }}
39 | {% endif %}
40 |
41 |
42 |
43 |
44 | {% block itemInclude %}
45 | {% include 'OutlandishAcadOowpBundle:Item:itemContent.html.twig' with {
46 | 'item': item,
47 | 'excerpt_length': excerpt_length,
48 | 'date' : date,
49 | 'tags' : tags
50 | } %}
51 | {% endblock %}
52 |
53 |
54 |
55 |
56 | {% endif %}
--------------------------------------------------------------------------------
/Resources/views/Event/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:postAbstract.html.twig' %}
2 |
3 | {% block content_sidebar %}
4 |
5 | {% include "OutlandishAcadOowpBundle:Partial:share.html.twig" with {
6 | 'post': post,
7 | 'title': 'event'} %}
8 |
9 |
10 | {% set latitude = post.latitude() %}
11 | {% set longitude = post.longitude() %}
12 | {% if post.dateString or post.address or latitude %}
13 |
14 | Event details
15 |
16 | {% if post.endDateString() %}
17 | Start date: {{ post.startDateString("j F Y") }}
18 | End date: {{ post.endDateString() }}
19 | {% elseif post.dateString() %}
20 | Date: {{ post.dateString("j F Y")}}
21 | {% endif %}
22 |
23 | {% if post.startTime() %}
24 | Time: {{ post.startTime() }}
25 | {% endif %}
26 |
27 | {% if post.address() %}
28 | Location: {{ post.address() | raw }}
29 | {% endif %}
30 |
31 | {% if latitude | length > 0 and longitude | length > 0 %}
32 |
35 | {% else %}
36 |
37 | {% endif %}
38 |
39 | {% endif %}
40 |
41 |
42 | {% for section in related_themes %}
43 |
55 | {% endfor %}
56 |
57 | {% endblock %}
58 |
59 | {% block scripts_footer %}
60 |
61 | {{ parent() }}
62 | {% endblock %}
63 |
64 |
--------------------------------------------------------------------------------
/OutlandishAcadOowpBundle.php:
--------------------------------------------------------------------------------
1 | __('Header Navigation'),
19 | 'footer' => __('Footer Navigation'),
20 | 'footer_about' => __('Footer About')
21 | )
22 | );
23 | }
24 |
25 | if(function_exists('add_image_size')) {
26 | add_image_size('avatar-square', '100', '100', array('center', 'center'));
27 | add_image_size('item-image-12', '630', '380', array('center', 'center'));
28 | add_image_size('item-image-12-small', '630', '290', array('center', 'center'));
29 | add_image_size('item-image-6', '307', '190', array('center', 'center'));
30 | add_image_size('item-image-4', '198', '122', array('center', 'center'));
31 | }
32 |
33 | if(function_exists('add_action')){
34 | add_action(
35 | 'admin_menu', function () {
36 | remove_menu_page( 'themes.php' );
37 | }
38 | );
39 | add_action(
40 | 'admin_menu', function () {
41 | add_menu_page('Menus', 'Menus', 'manage_options', 'nav-menus.php', '', 'dashicons-admin-appearance', 64);
42 | }
43 | );
44 | }
45 |
46 | if(function_exists('add_shortcode')){
47 |
48 | add_shortcode('outlandish_video', array($this, 'getVideo'));
49 | }
50 |
51 | }
52 |
53 | function getVideo($atts) {
54 |
55 | if (array_key_exists('vimeo', $atts)) {
56 | print '';
57 | }
58 |
59 | if (array_key_exists('youtube', $atts)) {
60 | print '';
61 | }
62 |
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/FacetedSearch/Facets/FacetPostToPost.php:
--------------------------------------------------------------------------------
1 | postType = $postType;
23 | }
24 |
25 | /**
26 | * This method generates the arguments for this facet to be passed through to
27 | * @param array $args
28 | * @return array
29 | */
30 | public function generateArguments($args = array())
31 | {
32 | $args = parent::generateArguments($args);
33 |
34 | $options = $this->getSelectedOptions();
35 |
36 | //if no connected items do not add any new content to the arguments
37 | if($options){
38 | $connectionNames = array();
39 |
40 | if(isset($args['post_type']) && is_array($args['post_type'])) {
41 | foreach ($args['post_type'] as $postType) {
42 | $connectionNames[] = $this->getConnectionName($postType);
43 | }
44 | } else {
45 | //todo: if any post_type then get all post_types and connections between them
46 | }
47 |
48 | $connectedIds = array();
49 | foreach($options as $option){
50 | $connectedIds[] = $option->name;
51 | }
52 |
53 | if(!isset($args['connected_type'])) {
54 | $args['connected_type'] = array();
55 | $args['connected'] = array();
56 | }
57 |
58 | $args['connected_type'] = array_merge($connectionNames, $args['connected_type']);
59 | $args['connected'] = array_merge($connectedIds, $args['connected']);
60 | }
61 |
62 | return $args;
63 | }
64 |
65 | /**
66 | * This is a copy of a function in the Post class in Outlandish\OowpBundle
67 | * todo: turn that method into a static one on Post Class
68 | * @param $postType
69 | * @return string
70 | */
71 | public function getConnectionName($postType)
72 | {
73 | $connection = array($postType, $this->postType);
74 | sort($connection);
75 | return implode('_', $connection);
76 | }
77 | }
--------------------------------------------------------------------------------
/Resources/views/Document/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Resource:postAbstract.html.twig' %}
2 |
3 | {% block content_main %}
4 | '{{ post.title() | raw }}'
5 |
6 | {% if post.bibliographicReference() %}
7 |
8 | {{ post.bibliographicReference() | raw }}
9 |
10 | {% endif %}
11 |
12 | {% if post.additionalInformation() %}
13 |
14 | {{ post.additionalInformation() | raw }}
15 |
16 | {% endif %}
17 |
18 | {% if documentUrl %}
19 |
31 | {% endif %}
32 |
33 | {% if attachment %}
34 |
46 | {% endif %}
47 |
48 | {% if post.content() %}
49 | Summary
50 | {{ post.content() | raw }}
51 | {% endif %}
52 |
53 | {% if post.documentText() %}
54 | Document text
55 | {{ post.documentText() | raw }}
56 | {% endif %}
57 |
58 | {% include "OutlandishAcadOowpBundle:Partial:connectedResources.html.twig" %}
59 |
60 | {{ render(controller('OutlandishAcadOowpBundle:Search:renderRelatedResources', {
61 | 'post': post,
62 | 'request': request
63 | } )) }}
64 |
65 | {% endblock %}
--------------------------------------------------------------------------------
/Controller/EventController.php:
--------------------------------------------------------------------------------
1 | query->set('meta_query', array(
22 | array(
23 | 'key'=>'start_date',
24 | 'value'=> date('Y/m/d'),
25 | 'compare'=>'>',
26 | 'type'=>'DATE'
27 | )
28 | ));
29 | $request->query->set('orderby', 'meta_value');
30 | $request->query->set('meta_key', 'start_date');
31 | $request->query->set('order', 'asc');
32 | $post = $this->querySingle(array(
33 | 'page_id' => $this->getIndexPageId(),
34 | 'post_type' => Page::postType()
35 | ));
36 |
37 | $items = Event::fetchFutureEvents();
38 |
39 | $pastItems = Event::fetchPastEvents();
40 |
41 | return array(
42 | 'post' => $post,
43 | 'items' => $items,
44 | 'past_items' => $pastItems
45 | );
46 | }
47 |
48 | /**
49 | * @param Request $request
50 | * @return array
51 | *
52 | * @Template("OutlandishAcadOowpBundle:Event:index.html.twig")
53 | */
54 | public function previousAction(Request $request) {
55 | $response = array();
56 |
57 | $post = $this->querySingle(array('page_id' => Event::PREVIOUS_EVENTS_PAGE_ID));
58 |
59 | $items = Event::fetchPastEvents();
60 |
61 | $response['post'] = $post;
62 | $response['items'] = $items;
63 | return $response;
64 | }
65 |
66 | /**
67 | * @param Request $request
68 | * @param mixed $name
69 | * @return array
70 | *
71 | * @Template("OutlandishAcadOowpBundle:Event:post.html.twig")
72 | */
73 | public function singleAction(Request $request, $name) {
74 | return parent::singleAction($request, $name);
75 | }
76 |
77 | protected function getIndexPageId()
78 | {
79 | return Event::postTypeParentId();
80 | }
81 |
82 | protected function getSearchResultPostTypes()
83 | {
84 | return array(Event::postType());
85 | }
86 |
87 | public function postTypes()
88 | {
89 | return array(Event::postType());
90 | }
91 |
92 | }
--------------------------------------------------------------------------------
/Resources/public/js/vendor/rem.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Module: rem - v1.3.2
3 | * Description: A polyfill to parse CSS links and rewrite pixel equivalents into head for non supporting browsers
4 | * Date Built: 2014-07-02
5 | * Copyright (c) 2014 | Chuck Carpenter ,Lucas Serven ;
6 | **/
7 | !function(a){"use strict";var b=function(){var a=document.createElement("div");return a.style.cssText="font-size: 1rem;",/rem/.test(a.style.fontSize)},c=function(){for(var a=document.getElementsByTagName("link"),b=[],c=0;c0?(r=[],q=[],n=[],d()):g()}},f=function(a,b){for(var c,d=k(a).replace(/\/\*[\s\S]*?\*\//g,""),e=/[\w\d\s\-\/\\\[\]:,.'"*()<>+~%#^$_=|@]+\{[\w\d\s\-\/\\%#:!;,.'"*()]+\d*\.?\d+rem[\w\d\s\-\/\\%#:!;,.'"*()]*\}/g,f=d.match(e),g=/\d*\.?\d+rem/g,h=d.match(g),i=/(.*\/)/,j=i.exec(b)[0],l=/@import (?:url\()?['"]?([^'\)"]*)['"]?\)?[^;]*/gm;null!==(c=l.exec(a));)n.push(j+c[1]);null!==f&&0!==f.length&&(o=o.concat(f),p=p.concat(h))},g=function(){for(var a=/[\w\d\s\-\/\\%#:,.'"*()]+\d*\.?\d+rem[\w\d\s\-\/\\%#:!,.'"*()]*[;}]/g,b=0;b= window_top &&
55 | top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
56 | left + $element.width() >= window_left &&
57 | left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
58 | return true;
59 | } else {
60 | return false;
61 | }
62 | }
63 |
64 | $.fn.extend({
65 | // watching for element's appearance in browser viewport
66 | appear: function(options) {
67 | var opts = $.extend({}, defaults, options || {});
68 | var selector = this.selector || this;
69 | if (!check_binded) {
70 | var on_check = function() {
71 | if (check_lock) {
72 | return;
73 | }
74 | check_lock = true;
75 |
76 | setTimeout(process, opts.interval);
77 | };
78 |
79 | $(window).scroll(on_check).resize(on_check);
80 | check_binded = true;
81 | }
82 |
83 | if (opts.force_process) {
84 | setTimeout(process, opts.interval);
85 | }
86 | selectors.push(selector);
87 | return $(selector);
88 | }
89 | });
90 |
91 | $.extend({
92 | // force elements's appearance check
93 | force_appear: function() {
94 | if (check_binded) {
95 | process();
96 | return true;
97 | };
98 | return false;
99 | }
100 | });
101 | })(jQuery);
102 |
--------------------------------------------------------------------------------
/Resources/views/Default/indexAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends '::layout.html.twig' %}
2 |
3 | {% block content %}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {% block contentPage %}
12 |
13 |
14 |
15 |
{{ post.title() | raw }}
16 |
17 | {{ post.content() | raw }}
18 |
19 |
20 |
21 | {% endblock %}
22 |
23 | {% if items | length > 0 %}
24 |
25 | {% block itemsIndex %}
26 |
27 | {% include 'OutlandishAcadOowpBundle:Search:searchSection.html.twig' with {
28 | 'facets': 'true',
29 | 'excerpt_length' : 20
30 | } %}
31 |
32 | {% endblock %}
33 |
34 | {% elseif sections | length > 0 %}
35 |
36 | {% for section in sections %}
37 | {% include 'OutlandishAcadOowpBundle:Section:' ~ section.layout ~ '.html.twig' %}
38 | {% endfor %}
39 |
40 | {% else %}
41 |
42 | {% block noSearchResults %}
43 | {% include 'OutlandishAcadOowpBundle:Search:noResults.html.twig' %}
44 | {% endblock %}
45 |
46 | {% endif %}
47 |
48 |
49 |
50 |
51 |
52 | {% block includeSide %}
53 |
54 | {% include "OutlandishAcadOowpBundle:Partial:share.html.twig" with {
55 | 'post': post,
56 | 'title': 'page'} %}
57 |
58 | {% if sideItems | length > 0 %}
59 |
60 |
80 |
81 | {% endif %}
82 |
83 | {% endblock %}
84 |
85 |
86 |
87 |
88 |
89 | {% endblock %}
--------------------------------------------------------------------------------
/Resources/views/Navigation/footer.html.twig:
--------------------------------------------------------------------------------
1 | {% block footer_main %}
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {% block footer_navigation %}
11 |
Navigation
12 |
13 |
18 |
19 | {% endblock %}
20 |
21 |
22 |
33 |
34 |
35 |
36 |
37 |
Get in touch
38 | {% block footer_address %}
39 |
40 |
41 | {{ email | raw }}
42 | {{ phonenumber | raw }}
43 |
44 |
45 |
{{ address | raw }}
46 |
47 | {% endblock %}
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
Follow us
59 |
60 |
61 | {% include "OutlandishAcadOowpBundle:Partial:social.html.twig" with {
62 | 'title': 'event'} %}
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | {% endblock %}
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
© State Crime 2014
81 |
82 |
83 |
An Outlandish website
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/Resources/views/Person/indexAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:indexAbstract.html.twig' %}
2 |
3 | {% block content %}
4 | {% block peopleContent %}
5 |
6 |
7 |
8 |
{{ post.title() | raw }}
9 |
10 |
11 | {{ post.content() | raw }}
12 |
13 |
14 | {% if post.featuredImage('large') %}
15 |
16 | {% block item_image %}
17 | {% include 'OutlandishAcadOowpBundle:Partial:featuredImg.html.twig' with {'post': post } %}
18 | {% endblock %}
19 |
20 | {% endif %}
21 |
22 | {% endblock %}
23 |
24 | {% if items | length > 0 %}
25 |
26 | {% include 'OutlandishAcadOowpBundle:Search:searchSection.html.twig' %}
27 |
28 | {% elseif roles | length > 0 %}
29 |
30 |
31 | {% for role in roles %}
32 |
33 | {% block roleInclude %}
34 |
35 | {{ role.title() | raw }}
36 |
37 |
38 |
39 | {{ role.content() | raw }}
40 |
41 |
42 | {% for person in role.people %}
43 |
44 | {% block personInclude %}
45 | {% include 'OutlandishAcadOowpBundle:Person:item.html.twig' with {
46 | 'item': person,
47 | 'size': 'small' } %}
48 | {% endblock %}
49 |
50 | {% endfor %}
51 |
52 |
53 |
54 | {% endblock %}
55 |
56 | {% endfor %}
57 |
58 |
59 | {% elseif people | length > 0 %}
60 |
61 |
62 | {% for person in people %}
63 |
64 | {% block itemInclude %}
65 | {% include 'OutlandishAcadOowpBundle:Person:item.html.twig' with {
66 | 'item': person,
67 | 'size': 'small'} %}
68 | {% endblock %}
69 |
70 | {% endfor %}
71 |
72 |
73 | {% else %}
74 |
75 | {% block noSearchResults %}
76 | {% include 'OutlandishAcadOowpBundle:Search:noResults.html.twig' %}
77 | {% endblock %}
78 |
79 | {% endif %}
80 |
81 |
82 | {% endblock %}
--------------------------------------------------------------------------------
/PostType/Page.php:
--------------------------------------------------------------------------------
1 | metadata('map');
18 | }
19 |
20 | /**
21 | * Create an array of contact people,
22 | * either by (1) using existing person object or (2) manually entering details
23 | * if (1), check if data is of type WP_Post and convert into OOWP_Post
24 | *
25 | * @return array|string
26 | */
27 | public function contactPeople()
28 | {
29 | $contactPeopleData = $this->metadata('contact_people');
30 | $contactPeople = array();
31 |
32 | if(is_array($contactPeopleData)) {
33 | foreach ($contactPeopleData as $person) {
34 | $contactPerson = array(
35 | 'name' => array(
36 | 'prefix' => '',
37 | 'content' => null,
38 | 'suffix' => ""
39 | ),
40 | 'email' => array(
41 | 'prefix' => 'E: ',
42 | 'content' => null,
43 | 'suffix' => ""
44 | ),
45 | 'phone' => array(
46 | 'prefix' => 'T: ',
47 | 'content' => null,
48 | 'suffix' => ""
49 | ),
50 | 'image' => array(
51 | 'url' => null,
52 | )
53 | );
54 | if ($person['contact_person_type'] == 'existing_contact_person') {
55 | $wpPost = $person['contact_person_existing'];
56 | if($wpPost instanceof \WP_Post){
57 | $id = $wpPost->ID;
58 | /** @var Person $personObject */
59 | $personObject = Person::fetchById($id);
60 | if($personObject instanceof Person){
61 | $contactPerson['name']['content'] = $personObject->title();
62 | $contactPerson['email']['content'] = $personObject->email();
63 | $contactPerson['phone']['content'] = $personObject->phone();
64 | $contactPerson['image']['url'] = $personObject->featuredImageUrl('medium');
65 | }
66 | }
67 | } else {
68 | $contactPerson['name']['content'] = $person['contact_person_name'];
69 | $contactPerson['email']['content'] = $person['contact_person_email'];
70 | $contactPerson['phone']['content'] = $person['contact_person_phone'];
71 | $contactPerson['image']['url'] = $this->imageUrlOnPage($person['contact_person_image'], 'medium');
72 | }
73 | $contactPeople[] = $contactPerson;
74 | }
75 | }
76 | return $contactPeople;
77 | }
78 |
79 | public function imageUrlOnPage($id, $image_size = 'thumbnail'){
80 | $image = wp_get_attachment_image_src($id, $image_size);
81 | return $image[0];
82 | }
83 |
84 | }
--------------------------------------------------------------------------------
/PostType/Document.php:
--------------------------------------------------------------------------------
1 | array('sortable' => 'any','cardinality' => 'many-to-many'),
12 | 'event' => array('sortable' => 'any','cardinality' => 'many-to-many'),
13 | 'news' => array('sortable' => 'any','cardinality' => 'many-to-many'),
14 | 'person' => array('sortable' => 'any','cardinality' => 'many-to-many'),
15 | 'place' => array('sortable' => 'any','cardinality' => 'many-to-many'),
16 | 'project' => array('sortable' => 'any','cardinality' => 'many-to-many'),
17 | 'theme' => array('sortable' => 'any','cardinality' => 'many-to-many'),
18 | );
19 |
20 | public function additionalInformation() {
21 | return $this->metadata('additional_information');
22 | }
23 |
24 | public function taxonomies() {
25 | $taxonomies = array(
26 | array(
27 | 'type' => Theme::postType(),
28 | 'name' => Theme::friendlyNamePlural()
29 | ),
30 | array(
31 | 'type' => Place::postType(),
32 | 'name' => Place::friendlyNamePlural()
33 | ),
34 | );
35 |
36 | foreach ( $taxonomies as &$taxonomy ) {
37 | $taxonomy['terms'] = $this->connected( $taxonomy['type'] );
38 | }
39 |
40 | return $taxonomies;
41 | }
42 |
43 | public function documentText() {
44 | return $this->metadata('document_text');
45 | }
46 |
47 | public function bibliographicReference() {
48 | return $this->metadata('bibliographic_reference');
49 | }
50 |
51 | public function documentUrl() {
52 | return $this->metadata('document_url');
53 | }
54 |
55 | public function attachment() {
56 | return $this->metadata('attachment');
57 | }
58 |
59 | public function attachmentSize() {
60 | $attachment = $this->attachment();
61 | $filename = get_attached_file($attachment['id']);
62 | if (file_exists($filename)) {
63 | return $this->humanReadableFilesize(filesize($filename));
64 | } else {
65 | return null;
66 | }
67 | }
68 |
69 | // Adapted from: http://www.php.net/manual/en/function.filesize.php
70 | public function humanReadableFilesize($size) {
71 | $mod = 1024;
72 |
73 | $units = explode(' ','B KB MB GB TB PB');
74 | for ($i = 0; $size > $mod; $i++) {
75 | $size /= $mod;
76 | }
77 |
78 | return round($size, 2) . ' ' . $units[$i];
79 | }
80 |
81 | // public static function fetchDocuments($queryArgs = array()) {
82 | // $defaults = array (
83 | // 'posts_per_page' => -1,
84 | // 'meta_query'=>array(
85 | // array(
86 | // 'key'=>'publication_date',
87 | // 'value'=> date('Y/m/d'),
88 | // 'compare'=>'>',
89 | // 'type'=>'DATE'
90 | // )
91 | // ),
92 | // 'orderby' => 'meta_value',
93 | // 'meta_key' => 'start_date',
94 | // 'order' => 'asc'
95 | // );
96 | //
97 | // $queryArgs = wp_parse_args($queryArgs, $defaults);
98 | // $futureEvents = self::fetchAll($queryArgs);
99 | //
100 | // return $futureEvents;
101 | // }
102 |
103 |
104 | }
--------------------------------------------------------------------------------
/Command/ModifyAcfFieldCommand.php:
--------------------------------------------------------------------------------
1 | setName('acadoowp:acf:modify')
22 | ->addArgument('id', InputArgument::REQUIRED, 'ACF group ID')
23 | ->addArgument('name', InputArgument::REQUIRED, 'ACF Field Name')
24 | ->addOption('new-name', null, InputOption::VALUE_OPTIONAL, 'New name')
25 | ->addOption('new-label', null, InputOption::VALUE_OPTIONAL, 'New label')
26 | ->setDescription('Modifies ACF field');
27 | }
28 |
29 | /**
30 | * Executes the current command.
31 | * @param InputInterface $input An InputInterface instance
32 | * @param OutputInterface $output An OutputInterface instance
33 | *
34 | * @return null|int null or 0 if everything went fine, or an error code
35 | */
36 | protected function execute(InputInterface $input, OutputInterface $output) {
37 | $this->output = $output;
38 | $id = $input->getArgument('id');
39 | $name = $input->getArgument('name');
40 |
41 | $output->writeln('Converting (' . $action . ') ACF ID=' . $id . ', name=' . $name);
42 |
43 | $newName = $input->getOption('new-name');
44 | if (!$newName) {
45 | throw new \RuntimeException('rename requires new name');
46 | }
47 | $newLabel = $input->getOption('new-label');
48 |
49 | $args = array(
50 | 'numberposts' => 1,
51 | 'post_type' => 'acf',
52 | 'post_status' => array( 'draft', 'publish', 'private', 'pending', 'future', 'auto-draft', 'trash' ),
53 | 'p' => $id
54 | );
55 | $acfs = get_posts( $args );
56 | if (!$acfs) {
57 | throw new \RuntimeException('ACF group not found');
58 | }
59 |
60 | $this->output->writeln('Renaming ' . $name . ' to ' . $newName);
61 |
62 | // wp_reset_postdata();
63 | $acf = $acfs[0];
64 | $metadata = get_post_meta( $acf->ID );
65 | foreach ($metadata as $key=>$value) {
66 | if (substr($key, 0, 6) != 'field_') {
67 | continue;
68 | }
69 | $acfArgs = unserialize($value[0]);
70 | if ($acfArgs['name'] == $name) {
71 | $acfArgs['name'] = $newName;
72 | if ($newLabel) {
73 | $acfArgs['label'] = $newLabel;
74 | }
75 | update_post_meta( $acf->ID, $key, $acfArgs );
76 | break;
77 | }
78 | }
79 |
80 | /** @var WordpressHelper $wpHelper */
81 | $wpHelper = $this->getContainer()->get('outlandish_oowp.helper.wp');
82 | $db = $wpHelper->db();
83 | $db->query($db->prepare("UPDATE {$db->postmeta} SET meta_key = %s WHERE meta_key = %s", $newName, $name));
84 | $db->query($db->prepare("UPDATE {$db->postmeta} SET meta_key = %s WHERE meta_key = %s", '_' . $newName, '_' . $name));
85 | }
86 | }
--------------------------------------------------------------------------------
/FacetedSearch/SearchFormHelper.php:
--------------------------------------------------------------------------------
1 | search = $search;
20 | }
21 |
22 | public function getSearchFormElements()
23 | {
24 | $elements = array();
25 | foreach($this->search->getFacets() as $facet){
26 | $elements[$facet->name] = $this->generateHTML($facet);
27 | }
28 | return $elements;
29 | }
30 |
31 |
32 | public function getFacet($name)
33 | {
34 | foreach($this->search->getFacets() as $facet){
35 | if($name == $facet->name){
36 | return $facet;
37 | }
38 | }
39 | return false;
40 | }
41 |
42 | public function generateHTML(Facet $facet)
43 | {
44 | $options = array();
45 | if($facet->isDefaultAll()){
46 | // $options[] = new FacetOption\FacetOption('', 'All', false);
47 | }
48 | /** @var FacetOption[] $options */
49 | $options = array_merge($options, $facet->options);
50 |
51 | $classes = array();
52 | if($facet->isExclusive())
53 | {
54 | $classes[] = 'facet-exclusive';
55 | }
56 |
57 | $classes = implode(' ', $classes);
58 |
59 | $html = "";
60 |
61 | $html .= "{$facet->getSection()}: ";
62 |
63 | //create an all button
64 | $selectedOptions = $facet->getSelectedOptions();
65 | if(!$facet->isExclusive()){
66 | $type = "radio";
67 | $optionNames = implode(',', array_map(function($a){
68 | return $a->getName();
69 | }, $options));
70 | $liClass = (count($selectedOptions) == count($options)) ? 'class="active"': null;
71 | $selected = (count($selectedOptions) == count($options)) ? 'checked' : '';
72 | $li = "";
73 | $li .= "All ";
74 | $li .= " ";
79 | $li .= " ";
80 | $html .= $li;
81 | } else {
82 | $type = "radio";
83 | }
84 |
85 | /** @var FacetOption $option */
86 | foreach($options as $option) {
87 | $selected = $option->selected && (count($selectedOptions) != count($options)) ? 'checked' : '';
88 | $liClass = $option->selected && (count($selectedOptions) != count($options)) ? 'class="active"': null;
89 | $html .= "";
90 | $html .= "{$option->getLabel()} ";
91 | $html .= " ";
96 | $html .= " ";
97 | }
98 | $html .= " ";
99 | return $html;
100 | }
101 |
102 | }
--------------------------------------------------------------------------------
/Command/AddAcfGroupCommand.php:
--------------------------------------------------------------------------------
1 | setName('acadoowp:acf:addGroup')
22 | ->addArgument('label', InputArgument::REQUIRED, 'ACF Group Label')
23 | ->addOption('name', null, InputOption::VALUE_OPTIONAL, 'Name of field.')
24 | ->setDescription('Adding ACF group');
25 | }
26 |
27 | /**
28 | * Executes the current command.
29 | * @param InputInterface $input An InputInterface instance
30 | * @param OutputInterface $output An OutputInterface instance
31 | *
32 | * @return null|int null or 0 if everything went fine, or an error code
33 | */
34 | protected function execute(InputInterface $input, OutputInterface $output) {
35 | $this->output = $output;
36 | $label = $input->getArgument('label');
37 | $name = $input->getOption('name');
38 |
39 | if (!$name) {
40 | $name = str_replace('', '_', $label);
41 | }
42 |
43 | $output->writeln('Adding ACF Group');
44 |
45 | $post = array(
46 | 'ID' => '',
47 | 'post_name' => 'acf_'.$name,
48 | 'post_title' => $label,
49 | 'post_status' => 'publish',
50 | 'post_type' => 'acf',
51 | // 'post_author' => [ ] // The user ID number of the author. Default is the current user ID.
52 | // 'ping_status' => [ 'closed' | 'open' ] // Pingbacks or trackbacks allowed. Default is the option 'default_ping_status'.
53 | // 'post_parent' => [ ] // Sets the parent of the new post, if any. Default 0.
54 | // 'menu_order' => [ ] // If new post is a page, sets the order in which it should appear in supported menus. Default 0.
55 | // 'to_ping' => // Space or carriage return-separated list of URLs to ping. Default empty string.
56 | // 'pinged' => // Space or carriage return-separated list of URLs that have been pinged. Default empty string.
57 | // 'post_password' => [ ] // Password for post, if any. Default empty string.
58 | // 'guid' => // Skip this and let Wordpress handle it, usually.
59 | // 'post_content_filtered' => // Skip this and let Wordpress handle it, usually.
60 | // 'post_excerpt' => [ ] // For all your post excerpt needs.
61 | 'post_date' => date('Y-m-d H:i:s'),
62 | 'post_date_gmt' => date('Y-m-d H:i:s')
63 | // 'comment_status' => [ 'closed' | 'open' ] // Default is the option 'default_comment_status', or 'closed'.
64 | // 'post_category' => [ array(, ...) ] // Default empty.
65 | // 'tags_input' => [ ', , ...' | array ] // Default empty.
66 | // 'tax_input' => [ array( => ) ] // For custom taxonomies. Default empty.
67 | // 'page_template' => [ ] // Requires name of template file, eg template.php. Default empty.
68 | );
69 |
70 | $output->writeln(wp_insert_post($post));
71 |
72 | }
73 |
74 |
75 |
76 | }
--------------------------------------------------------------------------------
/Resources/config/routing.yml:
--------------------------------------------------------------------------------
1 | # page routes
2 | home_page:
3 | path: /
4 | defaults:
5 | _controller: OutlandishAcadOowpBundle:Search:frontPage
6 | methods: [GET]
7 |
8 | contact_us:
9 | path: /contact-us/
10 | defaults:
11 | _controller: OutlandishAcadOowpBundle:Page:contactUs
12 | methods: [GET]
13 |
14 | # search routes
15 | search_ajax:
16 | path: /search/ajax/
17 | defaults:
18 | _controller: OutlandishAcadOowpBundle:Search:ajax
19 | methods: [GET]
20 |
21 | # article routes
22 | article_index:
23 | path: /articles/
24 | defaults:
25 | _controller: OutlandishAcadOowpBundle:News:index
26 | methods: [GET]
27 |
28 | article_post:
29 | path: /articles/{name}
30 | defaults:
31 | _controller: OutlandishAcadOowpBundle:News:single
32 | methods: [GET]
33 | requirements:
34 | name: "[\w-\/]+"
35 |
36 | # document routes
37 | document_index:
38 | path: /documents/
39 | defaults:
40 | _controller: OutlandishAcadOowpBundle:Deocument:index
41 | methods: [GET]
42 |
43 | document_post:
44 | path: /documents/{name}
45 | defaults:
46 | _controller: OutlandishAcadOowpBundle:Document:single
47 | methods: [GET]
48 | requirements:
49 | name: "[\w-\/]+"
50 |
51 | # event routes
52 | event_index:
53 | path: /events/
54 | defaults:
55 | _controller: OutlandishAcadOowpBundle:Event:index
56 | methods: [GET]
57 |
58 | event_previous:
59 | path: /events/previous/
60 | defaults:
61 | _controller: OutlandishAcadOowpBundle:Event:previous
62 | methods: [GET]
63 |
64 | event_post:
65 | path: /events/{name}
66 | defaults:
67 | _controller: OutlandishAcadOowpBundle:Event:single
68 | methods: [GET]
69 | requirements:
70 | name: "[\w-\/]+"
71 |
72 | # news routes
73 | news_index:
74 | path: /news/
75 | defaults:
76 | _controller: OutlandishAcadOowpBundle:News:index
77 | methods: [GET]
78 |
79 | news_post:
80 | path: /news/{name}
81 | defaults:
82 | _controller: OutlandishAcadOowpBundle:News:single
83 | methods: [GET]
84 | requirements:
85 | name: "[\w-\/]+"
86 |
87 | # person routes
88 | person_index:
89 | path: /people/
90 | defaults:
91 | _controller: OutlandishAcadOowpBundle:Person:index
92 | methods: [GET]
93 |
94 | person_post:
95 | path: /people/{name}
96 | defaults:
97 | _controller: OutlandishAcadOowpBundle:Person:single
98 | methods: [GET]
99 | requirements:
100 | name: "[\w-\/]+"
101 |
102 | # place routes
103 | place_index:
104 | path: /places/
105 | defaults:
106 | _controller: OutlandishAcadOowpBundle:Place:index
107 | methods: [GET]
108 |
109 | place_post:
110 | path: /places/{name}
111 | defaults:
112 | _controller: OutlandishAcadOowpBundle:Place:single
113 | methods: [GET]
114 | requirements:
115 | name: "[\w-\/]+"
116 |
117 | # project routes
118 | project_index:
119 | path: /project/
120 | defaults:
121 | _controller: OutlandishAcadOowpBundle:Project:index
122 | methods: [GET]
123 |
124 | project_post:
125 | path: /project/{name}
126 | defaults:
127 | _controller: OutlandishAcadOowpBundle:Project:single
128 | methods: [GET]
129 | requirements:
130 | name: "[\w-\/]+"
131 |
132 | # theme routes
133 | theme_index:
134 | path: /themes/
135 | defaults:
136 | _controller: OutlandishAcadOowpBundle:Theme:index
137 | methods: [GET]
138 |
139 | theme_post:
140 | path: /themes/{name}
141 | defaults:
142 | _controller: OutlandishAcadOowpBundle:Theme:single
143 | methods: [GET]
144 | requirements:
145 | name: "[\w-\/]+"
146 |
147 | # default post route
148 | default_post:
149 | path: /{names}/
150 | defaults:
151 | _controller: OutlandishAcadOowpBundle:Default:defaultPost
152 | methods: [GET]
153 | requirements:
154 | names: "[\w-\/]+"
155 |
--------------------------------------------------------------------------------
/Resources/views/Person/postAbstract.html.twig:
--------------------------------------------------------------------------------
1 | {% extends 'OutlandishAcadOowpBundle:Theme:postAbstract.html.twig' %}
2 |
3 | {% block content_main %}
4 |
5 |
6 |
7 | {% include "OutlandishAcadOowpBundle:Person:avatar.html.twig" with {
8 | 'post': post,
9 | 'size': 'avatar-square',
10 | 'classes': 'photo' } %}
11 |
12 |
13 |
14 |
15 |
16 | {{ post.title() | raw }}
17 |
18 | {{ post.role() | raw }}
19 |
20 |
21 | {{ post.metadata('honorific_prefix') | raw }}
22 | {{ post.metadata('given_name') | raw }}
23 | {{ post.metadata('family_name') | raw }}
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | {{ post.content() | raw }}
32 |
33 |
34 | {% if items | length > 0 %}
35 | Related Resources
36 | {{ search_form.orderby | raw }}
37 | {% include 'OutlandishAcadOowpBundle:Partial:searchResults.html.twig' %}
38 | {% endif %}
39 |
40 | {% endblock %}
41 |
42 | {% block content_sidebar %}
43 |
44 | {% include "OutlandishAcadOowpBundle:Partial:share.html.twig" with {
45 | 'post': post } %}
46 |
47 | {% if post.metadata('role') or post.metadata('email') or post.metadata('tel') %}
48 |
49 | Personal Details
50 |
51 |
52 |
53 |
{{ post.title() | raw }}
54 |
55 | {% if post.role() %}
56 |
{{ post.role() | raw }}
57 | {% endif %}
58 |
59 | {% if post.metadata('email') %}
60 |
61 |
62 | {{ post.metadata('email') | raw }}
63 |
64 | {% endif %}
65 |
66 | {% if post.metadata('tel') %}
67 |
68 |
69 | {{ post.metadata('tel') | raw }}
70 |
71 | {% endif %}
72 |
73 | {% if post.metadata('twitter_handle') %}
74 |
75 |
76 |
77 |
78 | {% endif %}
79 |
80 | {% if post.metadata('blog') %}
81 |
82 |
83 | {{ post.metadata('blog') | raw }}
84 |
85 | {% endif %}
86 |
87 |
88 |
89 | {% endif %}
90 |
91 | {% for section in related_themes %}
92 |
104 | {% endfor %}
105 |
106 | {{ render(controller('OutlandishAcadOowpBundle:Navigation:renderSideMenu', {
107 | 'maxDepth' : 3,
108 | 'rootPost': post.getRoot()
109 | })) }}
110 |
111 | {% endblock %}
--------------------------------------------------------------------------------
/Command/InstallPostTypeCommand.php:
--------------------------------------------------------------------------------
1 | setName('acadoowp:install:post-type')
33 | ->addArgument('inherit', InputArgument::REQUIRED, 'Post Type to inherit from')
34 | ->addArgument('name', InputArgument::OPTIONAL, 'name of the new Post Type class')
35 | ->addArgument('friendlyName', InputArgument::OPTIONAL, 'friendly name of the new Post Type class')
36 | ->addArgument('friendlyNamePlural', InputArgument::OPTIONAL, 'friendly name plural of the new Post Type class')
37 | ->setDescription('Adds a new Post Type to @OutlandishSiteBundle that inherits from $inherit');
38 | }
39 |
40 | /**
41 | * Executes the current command.
42 | * @param InputInterface $input An InputInterface instance
43 | * @param OutputInterface $output An OutputInterface instance
44 | *
45 | * @return null|int null or 0 if everything went fine, or an error code
46 | */
47 | protected function execute(InputInterface $input, OutputInterface $output) {
48 | $this->output = $output;
49 |
50 | $inherit = $input->getArgument('inherit');
51 | $name = $input->getArgument('name');
52 | $friendlyName = $input->getArgument('friendlyName');
53 | $friendlyNamePlural = $input->getArgument('friendlyNamePlural');
54 |
55 | //check to see that the SiteBundle exists. If not exit with error
56 | if(!$this->siteBundleExists()) return false;
57 |
58 | //find best fit for $inheirt PostType
59 | $inherit = $this->findPostType($inherit);
60 |
61 | //create PostType dir in @OutlandishSiteBundle if it doesn't exist
62 | //todo: mkdir PostTypes ...
63 |
64 | //if file does not exist
65 |
66 | //create file with $name name
67 | //todo: create file @OutlandishSiteBundle/PostTypes/$name
68 |
69 | //else if file inherits from $inherit
70 | //if class is abstract
71 | //make class not abstract
72 | //todo: remove abstract from file
73 | //todo: exit with success code and message
74 | //else
75 | //class already exists and is instantiated
76 | //todo: exit with success code and message
77 | //else
78 | //class already exists but is set up differently
79 | //todo: exit with error and message
80 |
81 | //open file and add contents
82 | //todo: open file created above
83 |
84 | //todo: create contents of file
85 |
86 | //todo: close file and save
87 |
88 | //check that class exists
89 | //todo: find out how we can check that the class exists as we expect it to
90 |
91 | }
92 |
93 | /**
94 | * checks to see whether @OutlandishSiteBundle exists
95 | * @return bool
96 | */
97 | protected function siteBundleExists()
98 | {
99 | //todo: check to see if site bundle exists return as bool
100 | return true;
101 | }
102 |
103 | protected function findPostType($postType)
104 | {
105 | //todo: return full reference to post type given the name above
106 | return "Outlandish/AcadOowpBundle/PostTypes/Post";
107 | }
108 |
109 | }
--------------------------------------------------------------------------------
/Command/AddAcfFieldCommand.php:
--------------------------------------------------------------------------------
1 | setName('acadoowp:acf:addField')
22 | ->addArgument('id', InputArgument::REQUIRED, 'ACF group ID')
23 | ->addArgument('label', InputArgument::REQUIRED, 'ACF Field Label')
24 | ->addArgument('name', InputArgument::REQUIRED, 'ACF Field Name')
25 | ->addArgument('type', InputArgument::REQUIRED, 'ACF Field Type')
26 | ->addOption('instructions', null, InputOption::VALUE_OPTIONAL, 'Instructions for authors. Shown when submitting data')
27 | ->setDescription('Adding ACF field to group');
28 | }
29 |
30 | /**
31 | * Executes the current command.
32 | * @param InputInterface $input An InputInterface instance
33 | * @param OutputInterface $output An OutputInterface instance
34 | *
35 | * @return null|int null or 0 if everything went fine, or an error code
36 | */
37 | protected function execute(InputInterface $input, OutputInterface $output) {
38 | $this->output = $output;
39 | $id = $input->getArgument('id');
40 | $label = $input->getArgument('label');
41 | $name = $input->getArgument('name');
42 | $type = $input->getArgument('type');
43 | $instructions = $input->getOption('instructions');
44 |
45 | $output->writeln('Adding ACF ID=' . $id . ', name=' . $name);
46 |
47 | $args = array(
48 | 'numberposts' => 1,
49 | 'post_type' => 'acf',
50 | 'post_status' => array( 'draft', 'publish', 'private', 'pending', 'future', 'auto-draft', 'trash' ),
51 | 'p' => $id
52 | );
53 | $acfs = get_posts( $args );
54 | if (!$acfs) {
55 | throw new \RuntimeException('ACF group not found');
56 | }
57 | $field_types = apply_filters('acf/registered_fields', array());
58 |
59 | $found = false;
60 |
61 | foreach ($field_types as $group) {
62 |
63 | if (array_key_exists($type, $group)) {
64 | $found = true;
65 | break;
66 | }
67 | }
68 |
69 | if (!$found) {
70 | throw new \RuntimeException('Invalid type');
71 | }
72 |
73 |
74 |
75 | // $output->writeln(print_r($field_types, true));
76 |
77 |
78 |
79 | wp_reset_postdata();
80 | $acf = $acfs[0];
81 | $metadata = get_post_meta( $acf->ID );
82 | $count = 0;
83 | foreach ($metadata as $key=>$value) {
84 | if (substr($key, 0, 6) == 'field_') {
85 | $count++;
86 | }
87 | }
88 |
89 | $key = 'field_' . uniqid();
90 | $newField = array(
91 | 'key' => $key,
92 | 'label' => $label,
93 | 'name' => $name,
94 | 'type' => $type,
95 | 'instructions' => $instructions,
96 | 'required' => 0,
97 | 'conditional_logic' => array(
98 | 'status' => 0,
99 | 'rules' => array(
100 | array(
101 | 'field' => null,
102 | 'operator' => '=='
103 | )
104 | ),
105 | 'allorany' => 'all'
106 | ),
107 | 'order_no' => $count
108 | );
109 | //todo: type-specific arguments
110 | add_post_meta($acf->ID, $key, $newField);
111 | $output->writeln(print_r($newField, true));
112 | }
113 |
114 | protected function addField($id, $name) {
115 | $this->output->writeln('Adding ' . $name);
116 | }
117 | }
--------------------------------------------------------------------------------
/Command/ConvertPostTypeCommand.php:
--------------------------------------------------------------------------------
1 | setName('acadoowp:convert:post-type')
33 | ->addArgument('old', InputArgument::REQUIRED, 'Old post type')
34 | ->addArgument('new', InputArgument::REQUIRED, 'New post type')
35 | ->setDescription('Converts post types');
36 | }
37 |
38 | /**
39 | * Executes the current command.
40 | * @param InputInterface $input An InputInterface instance
41 | * @param OutputInterface $output An OutputInterface instance
42 | *
43 | * @return null|int null or 0 if everything went fine, or an error code
44 | */
45 | protected function execute(InputInterface $input, OutputInterface $output) {
46 | $this->output = $output;
47 |
48 | $oldName = $input->getArgument('old');
49 | $newName = $input->getArgument('new');
50 |
51 | $output->writeln("Converting $oldName to $newName");
52 |
53 | $this->convertPosts($oldName, $newName);
54 | $this->convertAcf($oldName, $newName);
55 | $this->fixP2P($oldName, $newName);
56 | }
57 |
58 | protected function convertPosts($oldName, $newName) {
59 | $args = array(
60 | 'numberposts' => - 1,
61 | 'post_type' => $oldName,
62 | 'post_status' => array( 'draft', 'publish', 'private', 'pending', 'future', 'auto-draft', 'trash' )
63 | );
64 | $posts = get_posts( $args );
65 | wp_reset_postdata();
66 |
67 | if ( count( $posts ) > 0 ) {
68 | foreach ( $posts as $post ) {
69 | $this->output->writeln('Converting ' . $post->ID . ' to ' . $newName);
70 | set_post_type( $post->ID, $newName );
71 | }
72 | }
73 | }
74 |
75 | protected function convertAcf($oldName, $newName) {
76 | $args = array(
77 | 'numberposts' => - 1,
78 | 'post_type' => 'acf',
79 | 'post_status' => array( 'draft', 'publish', 'private', 'pending', 'future', 'auto-draft', 'trash' )
80 | );
81 | $acfs = get_posts( $args );
82 |
83 | if ( count( $acfs ) > 0 ) {
84 |
85 | foreach ( $acfs as $acf ) {
86 |
87 | $rules = get_post_meta( $acf->ID, 'rule' );
88 |
89 | foreach ( $rules as $rule ) {
90 | if ( isset( $rule['param'] ) && isset( $rule['value'] ) && $rule['param'] == 'post_type' && $rule['value'] == $oldName ) {
91 | $old_rule = $rule;
92 | $rule['value'] = $newName;
93 | update_post_meta( $acf->ID, 'rule', $rule, $old_rule );
94 | $this->output->writeln('Updating ACF ' . $acf->post_name);
95 | }
96 | }
97 | }
98 | }
99 | }
100 |
101 | protected function fixP2P() {
102 | /** @var $wpdb \wpdb */
103 | global $wpdb;
104 | $brokenP2p = $wpdb->get_results("SELECT j.*, f.post_type as from_type, t.post_type as to_type
105 | FROM {$wpdb->p2p} AS j
106 | INNER JOIN {$wpdb->posts} AS f ON j.p2p_from = f.id
107 | INNER JOIN {$wpdb->posts} AS t ON j.p2p_to = t.id
108 | WHERE j.p2p_type <> CONCAT(f.post_type, '_', t.post_type)
109 | AND j.p2p_type <> CONCAT(t.post_type, '_', f.post_type)");
110 | $update = "UPDATE {$wpdb->p2p} SET p2p_type = %s WHERE p2p_id = %d";
111 | /** @var PostManager $postManager */
112 | $postManager = $this->getContainer()->get('outlandish_oowp.post_manager');
113 | $postManager->init();
114 | foreach ($brokenP2p as $row) {
115 | /** @var Post $fromType */
116 | $fromType = $postManager->postTypeClass($row->from_type);
117 | $toType = $postManager->postTypeClass($row->to_type);
118 | if ($fromType && $toType) {
119 | $name = $fromType::getConnectionName($row->to_type);
120 | $wpdb->query($wpdb->prepare( $update, $name, $row->p2p_id ) );
121 | $this->output->writeln('Correcting p2p ' . $row->p2p_id);
122 | }
123 | }
124 | }
125 | }
--------------------------------------------------------------------------------
/Resources/public/js/facetsearch.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var defaultOptions = {
3 | selectors: {
4 | option: '.filter-option',
5 | selectedList: '#filter-selected ul',
6 | queryBox: '#q',
7 | querySubmit: '#submit-q',
8 | filterPanel: '#filter-panel',
9 | filterPanelToggle: '.filter-toggle',
10 | filterSection: '.filter-section',
11 | filterSectionTab: '#filter-tabs li',
12 | clearFilter: '.filter-clear'
13 | },
14 | autoSearch: true
15 | };
16 |
17 | var currentRotation = 0;
18 |
19 | var setupEvents = function(fs) {
20 | $(fs.options.selectors.option).click(function(e) {
21 | e.preventDefault();
22 | var t = $(e.target.nodeName == 'A' ? e.target.parentNode : e.target);
23 | var selector = t.attr('id') || t.attr('rel');
24 | if (fs.isSelected(selector)) {
25 | $('#'+selector).removeClass('selected');
26 | $('[rel='+selector+']').fadeOut(400, function() {this.remove();});
27 | fs.removeSelection(selector);
28 | } else {
29 | $('#'+selector).addClass('selected');
30 | var c = t.clone(true);
31 | c.attr('id', '');
32 | c.attr('rel', selector);
33 | $(fs.options.selectors.selectedList).append(c);
34 | c.fadeOut(0);
35 | c.fadeIn(400);
36 | fs.addSelection(selector);
37 | }
38 | if (fs.options.autoSearch) {
39 | fs.search();
40 | }
41 | });
42 |
43 | $(fs.options.selectors.querySubmit).click(function(e) {
44 | e.preventDefault();
45 | fs.setSearchTerm($(fs.options.selectors.queryBox).prop('value'));
46 | fs.search();
47 | });
48 |
49 | $(fs.options.selectors.queryBox).keypress(function(e) {
50 | if (e.which == 13) {
51 | e.preventDefault();
52 | $(fs.options.selectors.querySubmit).click();
53 | }
54 | });
55 |
56 | if (fs.options.selectors.filterPanelToggle != '') {
57 | $(fs.options.selectors.filterPanelToggle).click(function(e) {
58 | e.preventDefault();
59 | $(fs.options.selectors.filterPanel).slideToggle(400);
60 | });
61 | }
62 |
63 | $(fs.options.selectors.filterSectionTab).click(function(e) {
64 | e.preventDefault();
65 | var t = $(e.target.nodeName == 'A' ? e.target.parentNode : e.target);
66 | if (t.hasClass('active')) return;
67 | $(fs.options.selectors.filterSectionTab).removeClass('active');
68 | t.addClass('active');
69 | $(fs.options.selectors.filterSection).css('display', 'none');
70 | $('#'+t.attr('rel')).css('display', 'block');
71 | });
72 |
73 | $(fs.options.selectors.clearFilter).click(function(e) {
74 | e.preventDefault();
75 | $('.filter-icon span').css('transform', 'rotate(180deg)');
76 | setTimeout(function() {
77 | $('.filter-icon span').css('transform', 'rotate(0deg)');
78 | }, 600);
79 | $.each(fs.selections, function(i, selector) {
80 | $('#'+selector).removeClass('selected');
81 | $('[rel='+selector+']').fadeOut(400, function() {this.remove();});
82 | });
83 | fs.clearSelection();
84 | if (fs.options.autoSearch) {
85 | fs.search();
86 | }
87 | });
88 | };
89 |
90 | var FacetSearch = function(options) {
91 | this.options = $.extend({}, defaultOptions, options);
92 | this.selections = [];
93 | this.searchTerm = '';
94 | this.filterPanelShowing = false;
95 |
96 | setupEvents(this);
97 |
98 | var hash = window.location.hash.slice(1);
99 | var that = this;
100 | if (hash) {
101 | var data = {};
102 | var parts = hash.split('&');
103 | $.each(parts, function(i, part) {
104 | part = part.split('=');
105 | switch (part[0]) {
106 | case 'q':
107 | that.searchTerm = decodeURIComponent(part[1]);
108 | break;
109 | case 's':
110 | if (part[1]) {
111 | var selections = part[1].split(',');
112 | $.each(selections, function(j, sel) {
113 | that.selections.push(decodeURIComponent(sel));
114 | });
115 | }
116 | break;
117 | }
118 | });
119 | $(this.options.selectors.queryBox).prop('value', this.searchTerm);
120 | $.each(this.selections, function(i, selector) {
121 | var t = $('#'+selector);
122 | t.addClass('selected');
123 | var c = t.clone(true);
124 | c.attr('id', '');
125 | c.attr('rel', selector);
126 | $(that.options.selectors.selectedList).append(c);
127 | });
128 | this.search();
129 | }
130 | };
131 |
132 | FacetSearch.prototype.addSelection = function(selection) {
133 | this.selections.push(selection);
134 | };
135 |
136 | FacetSearch.prototype.removeSelection = function(selection) {
137 | var id = $.inArray(selection, this.selections);
138 | if (id > -1) {
139 | this.selections.splice(id, 1);
140 | }
141 | };
142 |
143 | FacetSearch.prototype.clearSelection = function() {
144 | this.selections = [];
145 | };
146 |
147 | FacetSearch.prototype.isSelected = function(selection) {
148 | return $.inArray(selection, this.selections) > -1;
149 | }
150 |
151 | FacetSearch.prototype.setSearchTerm = function(searchTerm) {
152 | this.searchTerm = searchTerm;
153 | };
154 |
155 | FacetSearch.prototype.search = function() {
156 | currentRotation += 720;
157 | $(this.options.selectors.querySubmit+' span').css('transform', 'rotate('+currentRotation+'deg)');
158 | var query = [];
159 | $.each(this.selections, function (i, selection) {
160 | var parts = selection.split('_');
161 | var s = parts[1].replace(/---/g, ')').replace(/--/g, '(').replace(/-/g, ' ');
162 | query.push(parts[0]+'[]='+encodeURIComponent(s));
163 | });
164 | if (this.searchTerm) {
165 | query.push('q='+encodeURIComponent(this.searchTerm));
166 | }
167 | var queryString = query.join('&');
168 | var hash = 's='+this.selections.map(function(s) {return encodeURIComponent(s);}).join(',')+'&q='+encodeURIComponent(this.searchTerm);
169 | $.ajax({
170 | url: window.searchAjaxUrl+'?'+queryString,
171 | success: function(data) {
172 | $('#content > div').html(data);
173 | window.location.hash = hash;
174 | }
175 | });
176 | };
177 |
178 | window['FacetSearch'] = FacetSearch;
179 | })();
--------------------------------------------------------------------------------
/FacetedSearch/Facets/Facet.php:
--------------------------------------------------------------------------------
1 | name = $name;
67 | $this->section = $section;
68 | $this->options = $options;
69 | }
70 |
71 | /**
72 | * @return boolean
73 | */
74 | public function isDefaultAll()
75 | {
76 | return $this->defaultAll;
77 | }
78 |
79 | /**
80 | * @return boolean
81 | */
82 | public function isExclusive()
83 | {
84 | return $this->exclusive;
85 | }
86 |
87 | /**
88 | * @return string
89 | */
90 | public function getName()
91 | {
92 | return $this->name;
93 | }
94 |
95 | /**
96 | * @return array
97 | */
98 | public function getOptions()
99 | {
100 | return $this->options;
101 | }
102 |
103 | /**
104 | * @return string
105 | */
106 | public function getSection()
107 | {
108 | return $this->section;
109 | }
110 |
111 | public function addOptions($array = array()){
112 | foreach($array as $item){
113 | if($item instanceof Post){
114 |
115 | }
116 | }
117 | }
118 |
119 | /**
120 | * add an option to the facet
121 | * eg. add a post type to the FacetPostType or FacetPostToPost
122 | * @param FacetOption $option
123 | * @return $this
124 | */
125 | public function addOption(FacetOption $option)
126 | {
127 | $this->options[] = $option;
128 | return $this;
129 | }
130 |
131 | /**
132 | * get only the options that have been selected
133 | * if no options selected, and defaultAll is true, return all options
134 | * @return array
135 | */
136 | public function getSelectedOptions()
137 | {
138 | $options = array_filter($this->options, function($a){
139 | return $a->selected;
140 | });
141 | //if no options have been selected and defaultAll is true
142 | if(count($options) == 0 && $this->defaultAll){
143 | $options = $this->options;
144 | }
145 | return $options;
146 | }
147 |
148 | /**
149 | * set the selected options as selected so we can generate the correct arguments
150 | * @param array $params | these will normally be the $_GET params
151 | * @return int $optionsSet | return the number of options that were set
152 | */
153 | public function setSelected(array $params)
154 | {
155 | $optionsSet = 0;
156 | if(count($this->options) > 0){
157 | if(array_key_exists($this->name, $params)){
158 | $selectedValues = $params[$this->name];
159 | if(!is_array($selectedValues)) $selectedValues = explode(',', $selectedValues);
160 |
161 | foreach($selectedValues as $value){
162 | foreach($this->options as $option){
163 | if($option->name == $value){
164 | $option->selected = true;
165 | $optionsSet++;
166 | }
167 | }
168 | if($this->exclusive && $optionsSet > 0) break;
169 | }
170 | }
171 | if($optionsSet == 0 && $this->defaultAll){
172 | $optionsSet = $this->setAll();
173 | }
174 | }
175 | return $optionsSet;
176 | }
177 |
178 | public function setAll()
179 | {
180 | $fakeParams = array($this->name => $this->getOptionNames());
181 | return $this->setSelected($fakeParams);
182 | }
183 |
184 | public function getOptionNames()
185 | {
186 | return array_map(function($a){
187 | return $a->name;
188 | }, $this->options);
189 | }
190 |
191 | /**
192 | * this method parses the passed in args with
193 | * overwritten in child classes, but they may call this as their may be generic things to do
194 | * @param array $args
195 | * @return array
196 | */
197 | public function generateArguments($args = array())
198 | {
199 | $args = wp_parse_args(array(), $args);
200 | return $args;
201 | }
202 |
203 | /**
204 | * @return boolean
205 | */
206 | public function isHidden()
207 | {
208 | return $this->hidden;
209 | }
210 |
211 | /**
212 | * @param boolean $hidden
213 | */
214 | public function setHidden($hidden)
215 | {
216 | $this->hidden = $hidden;
217 | }
218 |
219 |
220 | }
--------------------------------------------------------------------------------
/Resources/public/js/foundation/foundation.magellan.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs['magellan-expedition'] = {
5 | name : 'magellan-expedition',
6 |
7 | version : '5.1.1',
8 |
9 | settings : {
10 | active_class: 'active',
11 | threshold: 0, // pixels from the top of the expedition for it to become fixes
12 | destination_threshold: 20, // pixels from the top of destination for it to be considered active
13 | throttle_delay: 30 // calculation throttling to increase framerate
14 | },
15 |
16 | init : function (scope, method, options) {
17 | Foundation.inherit(this, 'throttle');
18 | this.bindings(method, options);
19 | },
20 |
21 | events : function () {
22 | var self = this,
23 | S = self.S,
24 | settings = self.settings;
25 |
26 | // initialize expedition offset
27 | self.set_expedition_position();
28 |
29 |
30 | S(self.scope)
31 | .off('.magellan')
32 | .on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) {
33 | e.preventDefault();
34 | var expedition = $(this).closest('[' + self.attr_name() + ']'),
35 | settings = expedition.data('magellan-expedition-init');
36 |
37 | var hash = this.hash.split('#').join(''),
38 | target = $('a[name='+hash+']');
39 | if (target.length === 0) target = $('#'+hash);
40 |
41 | // Account for expedition height if fixed position
42 | var scroll_top = target.offset().top;
43 | if (expedition.css('position') === 'fixed') {
44 | scroll_top = scroll_top - expedition.outerHeight();
45 | }
46 |
47 | $('html, body').stop().animate({
48 | 'scrollTop': scroll_top
49 | }, 700, 'swing', function () {
50 | window.location.hash = '#'+hash;
51 | });
52 | })
53 | .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay))
54 | .on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
55 | },
56 |
57 | check_for_arrivals : function() {
58 | var self = this;
59 | self.update_arrivals();
60 | self.update_expedition_positions();
61 | },
62 |
63 | set_expedition_position : function() {
64 | var self = this;
65 | $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
66 | var expedition = $(this),
67 | styles = expedition.attr('styles'), // save styles
68 | top_offset;
69 |
70 | expedition.attr('style', '');
71 | top_offset = expedition.offset().top;
72 |
73 | expedition.data(self.data_attr('magellan-top-offset'), top_offset);
74 | expedition.attr('style', styles);
75 | });
76 | },
77 |
78 | update_expedition_positions : function() {
79 | var self = this,
80 | window_top_offset = $(window).scrollTop();
81 |
82 | $('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
83 | var expedition = $(this),
84 | top_offset = expedition.data('magellan-top-offset');
85 |
86 | if (window_top_offset >= top_offset) {
87 | // Placeholder allows height calculations to be consistent even when
88 | // appearing to switch between fixed/non-fixed placement
89 | var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
90 | if (placeholder.length === 0) {
91 | placeholder = expedition.clone();
92 | placeholder.removeAttr(self.attr_name());
93 | placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
94 | expedition.before(placeholder);
95 | }
96 | expedition.css({position:'fixed', top: 0});
97 | } else {
98 | expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
99 | expedition.attr('style','');
100 | }
101 | });
102 | },
103 |
104 | update_arrivals : function() {
105 | var self = this,
106 | window_top_offset = $(window).scrollTop();
107 |
108 | $('[' + this.attr_name() + ']', self.scope).each(function() {
109 | var expedition = $(this),
110 | settings = settings = expedition.data(self.attr_name(true) + '-init'),
111 | offsets = self.offsets(expedition, window_top_offset),
112 | arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
113 | active_item = false;
114 | offsets.each(function(idx, item) {
115 | if (item.viewport_offset >= item.top_offset) {
116 | var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
117 | arrivals.not(item.arrival).removeClass(settings.active_class);
118 | item.arrival.addClass(settings.active_class);
119 | active_item = true;
120 | return true;
121 | }
122 | });
123 |
124 | if (!active_item) arrivals.removeClass(settings.active_class);
125 | });
126 | },
127 |
128 | offsets : function(expedition, window_offset) {
129 | var self = this,
130 | settings = expedition.data(self.attr_name(true) + '-init'),
131 | viewport_offset = (window_offset + settings.destination_threshold);
132 |
133 | return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) {
134 | var name = $(this).data(self.data_attr('magellan-arrival')),
135 | dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
136 | if (dest.length > 0) {
137 | var top_offset = dest.offset().top;
138 | return {
139 | destination : dest,
140 | arrival : $(this),
141 | top_offset : top_offset,
142 | viewport_offset : viewport_offset
143 | }
144 | }
145 | }).sort(function(a, b) {
146 | if (a.top_offset < b.top_offset) return -1;
147 | if (a.top_offset > b.top_offset) return 1;
148 | return 0;
149 | });
150 | },
151 |
152 | data_attr: function (str) {
153 | if (this.namespace.length > 0) {
154 | return this.namespace + '-' + str;
155 | }
156 |
157 | return str;
158 | },
159 |
160 | off : function () {
161 | this.S(this.scope).off('.magellan');
162 | this.S(window).off('.magellan');
163 | },
164 |
165 | reflow : function () {
166 | var self = this;
167 | // remove placeholder expeditions used for height calculation purposes
168 | $('[' + self.add_namespace('data-magellan-expedition-clone') + ']', self.scope).remove();
169 | }
170 | };
171 | }(jQuery, this, this.document));
172 |
--------------------------------------------------------------------------------
/PostType/Event.php:
--------------------------------------------------------------------------------
1 | array('sortable' => 'any','cardinality' => 'many-to-many'),
15 | 'news' => array('sortable' => 'any','cardinality' => 'many-to-many'),
16 | 'person' => array('sortable' => 'any','cardinality' => 'many-to-many'),
17 | 'place' => array('sortable' => 'any','cardinality' => 'many-to-many'),
18 | 'project' => array('sortable' => 'any','cardinality' => 'many-to-many'),
19 | 'theme' => array('sortable' => 'any','cardinality' => 'many-to-many'),
20 | );
21 |
22 | public function postTypeIcon() {
23 | return self::$menuIcon;
24 | }
25 |
26 | public static function fetchFutureEvents($queryArgs = array()) {
27 | $defaults = array (
28 | 'posts_per_page' => -1,
29 | 'meta_query'=>array(
30 | array(
31 | 'key'=>'start_date',
32 | 'value'=> date('Y/m/d'),
33 | 'compare'=>'>',
34 | 'type'=>'DATE'
35 | )
36 | ),
37 | 'orderby' => 'meta_value',
38 | 'meta_key' => 'start_date',
39 | 'order' => 'asc'
40 | );
41 |
42 | $queryArgs = wp_parse_args($queryArgs, $defaults);
43 | $futureEvents = self::fetchAll($queryArgs);
44 |
45 | return $futureEvents;
46 | }
47 |
48 | public static function fetchPastEvents($queryArgs = array()) {
49 | $defaults = array (
50 | 'posts_per_page' => -1,
51 | 'meta_query'=>array(
52 | array(
53 | 'key'=>'end_date',
54 | 'value'=> date('Y/m/d'),
55 | 'compare'=>'<=',
56 | 'type'=>'DATE'
57 | )
58 | ),
59 | 'orderby' => 'meta_value',
60 | 'meta_key' => 'start_date',
61 | 'order' => 'desc'
62 |
63 | );
64 |
65 | $queryArgs = wp_parse_args($queryArgs, $defaults);
66 | $pastEvents = self::fetchAll($queryArgs);
67 |
68 | return $pastEvents;
69 | }
70 |
71 | public static function sortByMonth($events) {
72 |
73 | $eventsByMonth = array();
74 | foreach($events as $event){
75 | $monthYear = $event->startMonthYearString();
76 | $position = '';
77 | foreach($eventsByMonth as $key => $value)
78 | {
79 | if($monthYear == $value['month']) {
80 | $position = $key;
81 | break;
82 | }
83 | }
84 | if (!is_int($position)) {
85 | $eventsByMonth[] = array (
86 | 'month' => $monthYear,
87 | 'posts' => array($event)
88 | );
89 | } else {
90 | $eventsByMonth[$position]['posts'][] = $event;
91 | }
92 | }
93 | return $eventsByMonth;
94 | }
95 |
96 | /**
97 | * return the month and year as string
98 | * @param string $format
99 | * @return bool|string
100 | */
101 | public function startMonthYearString($format = "F Y"){
102 | return date($format, $this->startDate());
103 | }
104 |
105 | /**
106 | * return start date for event as string
107 | * @param string $format | put in date format here
108 | * @return bool|string
109 | */
110 | public function startDateString($format = "j F Y"){
111 | return $this->startDate() ? date($format, $this->startDate()) : false;
112 | }
113 |
114 | /**
115 | * return the end date for event as a String
116 | * @param string $format
117 | * @return bool|string
118 | */
119 | public function endDateString($format = "j F Y"){
120 | return $this->endDate() ? date($format, $this->endDate()) : false;
121 | }
122 |
123 | /**
124 | * return the start date as a DateTime object
125 | * @return int
126 | */
127 | public function startDate(){
128 | return strtotime($this->metadata('start_date'));
129 | }
130 |
131 | /**
132 | * return the end date as a DateTime object
133 | * @return int
134 | */
135 | public function endDate(){
136 | return $this->metadata('end_date') ? strtotime($this->metadata('end_date')) : false;
137 | }
138 |
139 | /**
140 | * return the start time as a DateTime object
141 | * @return int
142 | */
143 | public function startTime(){
144 | return $this->metadata('start_time_');
145 |
146 | }
147 |
148 | /**return address
149 | * @return array|string
150 | */
151 | public function address() {
152 | $address = $this->metadata('event_address', true);
153 | if (!$address) $address = $this->postcode();
154 | return $address;
155 | }
156 |
157 | /**
158 | * @return array|string
159 | */
160 | public function postcode() {
161 | return $this->metadata('event_postcode', true);
162 | }
163 |
164 | /**
165 | * @return int
166 | */
167 | function latitude() {
168 | return $this->latitudeLongitudeNumber(0);
169 | }
170 |
171 | /**
172 | * @return int
173 | */
174 | function longitude() {
175 | return $this->latitudeLongitudeNumber(1);
176 | }
177 |
178 | /**
179 | * @return array|string
180 | */
181 | public function latitudeLongitude()
182 | {
183 | return $this->metadata('event_latitude_longitude') != self::NOT_FOUND_MESSAGE ? $this->metadata('event_latitude_longitude') : '';
184 | }
185 |
186 | /**
187 | * Get latitude(index = 0) and longitude (index = 1) for event by their index number
188 | * Return false if latitudeLongitude not found, or if index parameter is > 2 or < 0
189 | *
190 | * @param $index
191 | * @return bool
192 | */
193 | public function latitudeLongitudeNumber($index)
194 | {
195 | if(!$this->latitudeLongitude()) return false;
196 | $lat_lng = explode(",", $this->latitudeLongitude());
197 | if(count($lat_lng) > 2 || $index > 1 || $index < 0) return false;
198 |
199 | return $lat_lng[$index];
200 | }
201 |
202 | /**
203 | * Attempt to save event coordinates from
204 | * (1) event address acf and postcode acf
205 | * (2) event postcode acf
206 | * * If unsuccessful, insert NOT_FOUND_MESSAGE in 'event_latitude_longitude' acf *
207 | *
208 | * return false
209 | * */
210 | public function onSave($postData) {
211 | if ($this->post_type == Event::postType() && ($this->latitudeLongitude() == '' || $this->latitudeLongitude() == self::NOT_FOUND_MESSAGE )){
212 | $location = urlencode($this->address() . $this->postcode());
213 | $data = json_decode(file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address={$location}&sensor=false"));
214 | if ($data->status == 'OK') {
215 | $lat = $data->results[0]->geometry->location->lat;
216 | $lng = $data->results[0]->geometry->location->lng;
217 | $value = $lat . "," . $lng;
218 | } else {
219 | $value = self::NOT_FOUND_MESSAGE;
220 | }
221 | update_post_meta($this->ID, "event_latitude_longitude", $value);
222 | }
223 | return false;
224 | }
225 | }
--------------------------------------------------------------------------------
/Resources/public/js/foundation/foundation.dropdown.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.dropdown = {
5 | name : 'dropdown',
6 |
7 | version : '5.1.1',
8 |
9 | settings : {
10 | active_class: 'open',
11 | is_hover: false,
12 | opened: function(){},
13 | closed: function(){}
14 | },
15 |
16 | init : function (scope, method, options) {
17 | Foundation.inherit(this, 'throttle');
18 |
19 | this.bindings(method, options);
20 | },
21 |
22 | events : function (scope) {
23 | var self = this,
24 | S = self.S;
25 |
26 | S(this.scope)
27 | .off('.dropdown')
28 | .on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) {
29 | var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
30 | e.preventDefault();
31 | if (!settings.is_hover || Modernizr.touch) self.toggle(S(this));
32 | })
33 | .on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
34 | var $this = S(this);
35 | clearTimeout(self.timeout);
36 |
37 | if ($this.data(self.data_attr())) {
38 | var dropdown = S('#' + $this.data(self.data_attr())),
39 | target = $this;
40 | } else {
41 | var dropdown = $this;
42 | target = S("[" + self.attr_name() + "='" + dropdown.attr('id') + "']");
43 | }
44 |
45 | var settings = target.data(self.attr_name(true) + '-init') || self.settings;
46 |
47 | if(S(e.target).data(self.data_attr()) && settings.is_hover) {
48 | self.closeall.call(self);
49 | }
50 |
51 | if (settings.is_hover) self.open.apply(self, [dropdown, target]);
52 | })
53 | .on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
54 | var $this = S(this);
55 | self.timeout = setTimeout(function () {
56 | if ($this.data(self.data_attr())) {
57 | var settings = $this.data(self.data_attr(true) + '-init') || self.settings;
58 | if (settings.is_hover) self.close.call(self, S('#' + $this.data(self.data_attr())));
59 | } else {
60 | var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
61 | settings = target.data(self.attr_name(true) + '-init') || self.settings;
62 | if (settings.is_hover) self.close.call(self, $this);
63 | }
64 | }.bind(this), 150);
65 | })
66 | .on('click.fndtn.dropdown', function (e) {
67 | var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
68 |
69 | if (S(e.target).data(self.data_attr()) || S(e.target).parent().data(self.data_attr())) {
70 | return;
71 | }
72 | if (!(S(e.target).data('revealId')) &&
73 | (parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') ||
74 | $.contains(parent.first()[0], e.target)))) {
75 | e.stopPropagation();
76 | return;
77 | }
78 |
79 | self.close.call(self, S('[' + self.attr_name() + '-content]'));
80 | })
81 | .on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
82 | self.settings.opened.call(this);
83 | })
84 | .on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
85 | self.settings.closed.call(this);
86 | });
87 |
88 | S(window)
89 | .off('.dropdown')
90 | .on('resize.fndtn.dropdown', self.throttle(function () {
91 | self.resize.call(self);
92 | }, 50)).trigger('resize');
93 | },
94 |
95 | close: function (dropdown) {
96 | var self = this;
97 | dropdown.each(function () {
98 | if (self.S(this).hasClass(self.settings.active_class)) {
99 | self.S(this)
100 | .css(Foundation.rtl ? 'right':'left', '-99999px')
101 | .removeClass(self.settings.active_class);
102 | self.S(this).trigger('closed');
103 | }
104 | });
105 | },
106 |
107 | closeall: function() {
108 | var self = this;
109 | $.each(self.S('[' + this.attr_name() + '-content]'), function() {
110 | self.close.call(self, self.S(this))
111 | });
112 | },
113 |
114 | open: function (dropdown, target) {
115 | this
116 | .css(dropdown
117 | .addClass(this.settings.active_class), target);
118 | dropdown.trigger('opened');
119 | },
120 |
121 | data_attr: function () {
122 | if (this.namespace.length > 0) {
123 | return this.namespace + '-' + this.name;
124 | }
125 |
126 | return this.name;
127 | },
128 |
129 | toggle : function (target) {
130 | var dropdown = this.S('#' + target.data(this.data_attr()));
131 | if (dropdown.length === 0) {
132 | // No dropdown found, not continuing
133 | return;
134 | }
135 |
136 | this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown));
137 |
138 | if (dropdown.hasClass(this.settings.active_class)) {
139 | this.close.call(this, dropdown);
140 | } else {
141 | this.close.call(this, this.S('[' + this.attr_name() + '-content]'))
142 | this.open.call(this, dropdown, target);
143 | }
144 | },
145 |
146 | resize : function () {
147 | var dropdown = this.S('[' + this.attr_name() + '-content].open'),
148 | target = this.S("[" + this.attr_name() + "='" + dropdown.attr('id') + "']");
149 |
150 | if (dropdown.length && target.length) {
151 | this.css(dropdown, target);
152 | }
153 | },
154 |
155 | css : function (dropdown, target) {
156 | var offset_parent = dropdown.offsetParent(),
157 | position = target.offset();
158 |
159 | position.top -= offset_parent.offset().top;
160 | position.left -= offset_parent.offset().left;
161 |
162 | if (this.small()) {
163 | dropdown.css({
164 | position : 'absolute',
165 | width: '95%',
166 | 'max-width': 'none',
167 | top: position.top + target.outerHeight()
168 | });
169 | dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');
170 | } else {
171 | if (!Foundation.rtl && this.S(window).width() > dropdown.outerWidth() + target.offset().left) {
172 | var left = position.left;
173 | if (dropdown.hasClass('right')) {
174 | dropdown.removeClass('right');
175 | }
176 | } else {
177 | if (!dropdown.hasClass('right')) {
178 | dropdown.addClass('right');
179 | }
180 | var left = position.left - (dropdown.outerWidth() - target.outerWidth());
181 | }
182 |
183 | dropdown.attr('style', '').css({
184 | position : 'absolute',
185 | top: position.top + target.outerHeight(),
186 | left: left
187 | });
188 | }
189 |
190 | return dropdown;
191 | },
192 |
193 | small : function () {
194 | return matchMedia(Foundation.media_queries.small).matches &&
195 | !matchMedia(Foundation.media_queries.medium).matches;
196 | },
197 |
198 | off: function () {
199 | this.S(this.scope).off('.fndtn.dropdown');
200 | this.S('html, body').off('.fndtn.dropdown');
201 | this.S(window).off('.fndtn.dropdown');
202 | this.S('[data-dropdown-content]').off('.fndtn.dropdown');
203 | this.settings.init = false;
204 | },
205 |
206 | reflow : function () {}
207 | };
208 | }(jQuery, this, this.document));
209 |
--------------------------------------------------------------------------------