removed linked materials from actuality page
This commit is contained in:
parent
1ca1912fe2
commit
f9144db774
@ -10,6 +10,20 @@
|
||||
function materio_search_user_default_permissions() {
|
||||
$permissions = array();
|
||||
|
||||
// Exported permission: 'access to materio database'.
|
||||
$permissions['access to materio database'] = array(
|
||||
'name' => 'access to materio database',
|
||||
'roles' => array(
|
||||
'Adhérent' => 'Adhérent',
|
||||
'Premium' => 'Premium',
|
||||
'Student' => 'Student',
|
||||
'Utilisateur Alpha Tester' => 'Utilisateur Alpha Tester',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'materio_search_api',
|
||||
);
|
||||
|
||||
// Exported permission: 'administer materio_search_api'.
|
||||
$permissions['administer materio_search_api'] = array(
|
||||
'name' => 'administer materio_search_api',
|
||||
|
@ -25,6 +25,7 @@ features[search_api_index][] = materiaux_breves_fr
|
||||
features[search_api_index][] = referencement
|
||||
features[search_api_index][] = referencement_en
|
||||
features[search_api_index][] = referencement_fr
|
||||
features[user_permission][] = access to materio database
|
||||
features[user_permission][] = administer materio_search_api
|
||||
features[user_permission][] = administer search_api
|
||||
features[user_permission][] = administer search_api_saved_searches
|
||||
|
@ -14,6 +14,10 @@
|
||||
*/
|
||||
function materio_search_api_permission() {
|
||||
return array(
|
||||
'access to materio database' => array(
|
||||
'title' => t('Access to materio database'),
|
||||
'description' => t('Access to materio database.'),
|
||||
),
|
||||
'use materio search api' => array(
|
||||
'title' => t('Use materio search api'),
|
||||
'description' => t('Use materio search api.'),
|
||||
|
@ -131,7 +131,7 @@ function materio_search_api_results_search(){
|
||||
$keys = func_get_args();
|
||||
// dsm($args, 'args');
|
||||
$typed = implode('/', $keys);
|
||||
|
||||
|
||||
// remove query page params
|
||||
preg_match_all('/\?page=([0-9]+)/', $typed, $pages);
|
||||
//dsm($pages, '$pages');
|
||||
@ -228,7 +228,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
||||
# define search api solr index
|
||||
$taxo_index_machine_name = variable_get('taxonomysearchindex_'.$language->language, -1);
|
||||
$taxo_index = search_api_index_load($taxo_index_machine_name);
|
||||
|
||||
|
||||
#create the solr query for taxonomy search
|
||||
$taxo_query = search_api_query($taxo_index_machine_name, $query_options)
|
||||
->keys($typed);
|
||||
@ -253,7 +253,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
||||
|
||||
#add range to retriev the real current results
|
||||
$taxo_query->range($offset, $limit);
|
||||
|
||||
|
||||
# execute solr query and record results
|
||||
$taxo_results = $taxo_query->execute();
|
||||
// dsm($taxo_results, "taxo results");
|
||||
@ -272,7 +272,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
||||
$fulltxt_index_machine_name = variable_get('fulltextsearchindex_'.$language->language, -1);
|
||||
$fulltxt_index = search_api_index_load($fulltxt_index_machine_name);
|
||||
|
||||
#then calculate the good offset and limit for the complementary search
|
||||
#then calculate the good offset and limit for the complementary search
|
||||
$fulltxt_offset = $offset - $taxo_results['result count'];
|
||||
|
||||
#create the solr query for taxonomy search
|
||||
@ -296,10 +296,10 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
||||
$nid_filter->condition('nid', $nid, '<>');
|
||||
|
||||
$fulltxt_query->filter($nid_filter);
|
||||
|
||||
|
||||
# add user access solr query option
|
||||
$fulltxt_query->setOption('search_api_access_account', $user);
|
||||
|
||||
|
||||
# execute solr query and record results
|
||||
$fulltxt_results = $fulltxt_query->execute();
|
||||
// dsm($fulltxt_results, "fulltxt_results");
|
||||
@ -320,7 +320,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
||||
}
|
||||
|
||||
function msa_solrquery_breves($typed, $language, $user, $offset, $limit){
|
||||
|
||||
|
||||
$index_machine_name = variable_get('brevessearchindex_'.$language->language, -1);
|
||||
// dsm($index_machine_name, '$index_machine_name');
|
||||
$index = search_api_index_load($index_machine_name);
|
||||
@ -353,7 +353,7 @@ function msa_solrquery_breves($typed, $language, $user, $offset, $limit){
|
||||
# in case of free user search, run a real search to indicate how much items you could find
|
||||
$could_query = search_api_query($could_index_machine_name, array('conjunction'=>'OR', 'parse mode'=>'direct'))
|
||||
->keys($typed);
|
||||
|
||||
|
||||
$could_results = $could_query->execute();
|
||||
// dsm($could_results, 'could_results');
|
||||
$results['could results'] = $could_results;
|
||||
@ -383,10 +383,10 @@ function msa_solrquery_breves($typed, $language, $user, $offset, $limit){
|
||||
$results['items'] = $items;
|
||||
$results['breves count'] = $results['result count'];
|
||||
$results['result count'] = count($items);
|
||||
|
||||
|
||||
// dsm($results, "results");
|
||||
# TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
|
||||
return $results;
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
@ -444,13 +444,15 @@ function materio_search_api_actuality(){
|
||||
continue;
|
||||
|
||||
$items[] = $breve;
|
||||
$materiaux = field_get_items('node',$breve,'field_materiau_ref');
|
||||
// dsm($materiaux, 'materiaux');
|
||||
if($materiaux){
|
||||
foreach ($materiaux as $value) {
|
||||
$materiau = node_load($value['target_id']);
|
||||
if(node_access('view', $materiau))
|
||||
$items[] = $materiau;
|
||||
if(user_access('access to materio database')){
|
||||
$materiaux = field_get_items('node',$breve,'field_materiau_ref');
|
||||
// dsm($materiaux, 'materiaux');
|
||||
if($materiaux){
|
||||
foreach ($materiaux as $value) {
|
||||
$materiau = node_load($value['target_id']);
|
||||
if(node_access('view', $materiau))
|
||||
$items[] = $materiau;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user