| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675 | 
							- <?php
 
- /**
 
-  * @file
 
-  * This is the file description for Materiobasemod module.
 
-  *
 
-  * In this more verbose, multi-line description, you can specify what this
 
-  * file does exactly. Make sure to wrap your documentation in column 78 so
 
-  * that the file can be displayed nicely in default-sized consoles.
 
-  */
 
- // define(MATERIO_SEARCH_API_RESULTS_PATH, 'explore');
 
- /**
 
-  * Implements hook_permission().
 
-  */
 
- function materio_search_api_permission() {
 
-   return array(
 
-     'use materio search api' =>  array(
 
-       'title' => t('Use materio search api'),
 
-       'description' => t('Use materio search api.'),
 
-     ),
 
-     'use materio search api for breves' =>  array(
 
-       'title' => t('Use materio search api for breves'),
 
-       'description' => t('Use materio search api for breves.'),
 
-     ),
 
-     'use materio search api autocomplete' =>  array(
 
-       'title' => t('Use materio search api autocomplete'),
 
-       'description' => t('Use materio search api autocomplete.'),
 
-     ),
 
-     'use materio search api viewmode selection' =>  array(
 
-       'title' => t('Use materio search api viewmode selection'),
 
-       'description' => t('Use materio search api viewmode selection.'),
 
-     ),
 
-     'administer materio_search_api' => array(
 
-       'title' => t('administer Materio search api'),
 
-       'description' => t('Administer materio search api.'),
 
-     ),
 
-     'use materio search api filters' => array(
 
-       'title' => t('use Materio search api filters'),
 
-       'description' => t('Use materio search api filters.'),
 
-     ),
 
-   );
 
- }
 
- /**
 
-  * Implements hook_menu().
 
-  */
 
- function materio_search_api_menu() {
 
-   $items = array();
 
-   $base = array(
 
-     'type' => MENU_CALLBACK,
 
-     'file' => 'materio_search_api.pages.inc',
 
-   );
 
-   $items['admin/config/search/search_api/materiosearchapi'] = array(
 
-     'title' => 'Materio Search Api',
 
-     'page callback' => 'drupal_get_form',
 
-     'page arguments' => array('materio_search_api_settings'),
 
-     'access arguments' => array('administer materio_search_api'),
 
-     'file' => 'materio_search_api.admin.inc',
 
-     'type' => MENU_LOCAL_TASK,
 
-   );
 
-   $items['materiosearchapi/autocomplete/dbselect'] = $base+array(
 
-     'access arguments' => array('use materio search api autocomplete'),
 
-     'page callback' => 'materio_search_api_autocomplete_dbselect',
 
-   );
 
-   $items['materiosearchapi/autocomplete/searchapi'] = $base+array(
 
-     'access arguments' => array('use materio search api autocomplete'),
 
-     'page callback' => 'materio_search_api_autocomplete_searchapi',
 
-   );
 
-   $items['explore'] = $base+array(
 
-     // 'access arguments' => array('use materio search api'),
 
-     'access callback' => 'materio_search_api_access_search',
 
-     'page callback' => 'materio_search_api_results_search',
 
-     'title' => t('Explore'),
 
-     //'page argument' => array(1,2,3),
 
-   );
 
-   $items['actuality'] = $base+array(
 
-     // 'access arguments' => array(),
 
-     'page callback' => 'materio_search_api_actuality',
 
-     // 'page argument' => array(),
 
-     'access callback' => TRUE,
 
-   );
 
-   $items['materiosearchapi/viewmode/change'] = $base+array(
 
-     'access arguments' => array('use materio search api viewmode selection'),
 
-     'page callback' => 'materio_search_api_viewmode_change',
 
-     'page argument' => array(3),
 
-   );
 
-   return $items;
 
- }
 
- function materio_search_api_access_search(){
 
-   return user_access('use materio search api for breves') || user_access('use materio search api');
 
- }
 
- /**
 
-  * Implements hook_search_api_data_type_info().
 
-  *
 
-  * Declare our new type to Search API so it can be selected for a field.
 
-  */
 
- function materio_search_api_search_api_data_type_info() {
 
-   return array(
 
-     'edge_n2_kw_text' => array(
 
-       'name' => t('Fulltext (partial)'),
 
-       'fallback' => 'text',
 
-     ),
 
-   );
 
-   return $types;
 
- }
 
- /**
 
-  * Implements hook_search_api_solr_dynamic_field_info().
 
-  *
 
-  * Tell Search API Solr how to index our new data type.
 
-  */
 
- function materio_search_api_search_api_solr_dynamic_field_info() {
 
-   return array(
 
-     'edge_n2_kw_text' => array(
 
-       'prefix' => 'tem',
 
-       'always multiValued' => TRUE,
 
-     ),
 
-   );
 
- }
 
- /**
 
-  * hook_entity_property_info_alter().
 
-  */
 
- function materio_search_api_entity_property_info_alter(&$info){
 
-   // dsm($info, 'hook_entity_property_info_alter | info');
 
-   // watchdog('materio solr', 'materio_search_api_entity_property_info_alter', array());
 
-   $properties = &$info['node']['properties'];
 
-   for ($i=1; $i <= 5 ; $i++) { 
 
-     $properties['materio_search_api_taxonomy_term_'.$i] = array(
 
-       'type'=>'taxonomy_term',
 
-       'label'=> t('Main taxonomy term '.$i),
 
-       // 'query callback'=>'entity_metadata_table_query',
 
-       'getter callback'=>'materio_search_api_get_main_taxonomy_term_'.$i,
 
-     );
 
-   }
 
-   // $properties['materio_search_api_taxonomy_term_'.$i] = array(
 
-   //   'type'=>'list<taxonomy_term>',
 
-   //   'label'=> t('Taxonomy term after 5 mains'),
 
-   //   // 'query callback'=>'entity_metadata_table_query',
 
-   //   'getter callback'=>'materio_search_api_get_taxonomy_terms_after_5',
 
-   // );
 
-   // return $properties;
 
-   $company_term_props = &$info['taxonomy_term']['bundles']['company']['properties'];
 
-   $company_term_props['country'] = array(
 
-     'label' => t("Country"), 
 
-     'description' => t("Company's Country get from tode node."), 
 
-     'type' => 'text', 
 
-     'getter callback' => 'company_term_property_country_get_props',
 
-   );
 
- }
 
- function materio_search_api_get_main_taxonomy_term_1($item){
 
-   // dsm($item, 'item');
 
-   // watchdog('materio solr', 'materio_search_api_get_taxonomy_term_1', array());
 
-   return materio_search_api_get_onto_term($item, 0);
 
- }
 
- function materio_search_api_get_main_taxonomy_term_2($item){
 
-   // dsm($item, 'item');
 
-   return materio_search_api_get_onto_term($item, 1);
 
- }
 
- function materio_search_api_get_main_taxonomy_term_3($item){
 
-   // dsm($item, 'item');
 
-   return materio_search_api_get_onto_term($item, 2);
 
- }
 
- function materio_search_api_get_main_taxonomy_term_4($item){
 
-   // dsm($item, 'item');
 
-   return materio_search_api_get_onto_term($item, 3);
 
- }
 
- function materio_search_api_get_main_taxonomy_term_5($item){
 
-   // dsm($item, 'item');
 
-   return materio_search_api_get_onto_term($item, 4);
 
- }
 
- function materio_search_api_get_onto_term($item, $delta){
 
-   // dsm($item, 'item');
 
-   // dsm($delta, 'delta');
 
-   if(isset($item->field_onthologie['und'][$delta]))
 
-     return taxonomy_term_load($item->field_onthologie['und'][$delta]['tid']);
 
-   return null;
 
- }
 
- function company_term_property_country_get_props($term){
 
-   // dsm($term, 'company_term_property_country_get_props : term');
 
-   if( $node = company_get_tode_node($term) ){
 
-     // $field_values = field_get_items('node',$node,'field_public_address');
 
-     // dsm($field_values, 'field_values');
 
-     
 
-     $output = rip_tags(render(field_view_field('node',$node,'field_public_address')));
 
-     // dsm($output, 'output');
 
-     
 
-     return $output;
 
-   }
 
-   return null;
 
- }
 
- function company_get_tode_node($term){
 
-   if(module_exists('tode'))
 
-     if( $entitys = tode_get_nids_from_term($term))
 
-       if(isset($entitys['node']))
 
-         foreach ($entitys['node'] as $nid => $n)
 
-           return node_load($nid);
 
-   return false;
 
- }
 
- function rip_tags($string) { 
 
-   // ----- remove HTML TAGs ----- 
 
-   $string = preg_replace ('/<[^>]*>/', ' ', $string); 
 
-   
 
-   // ----- remove control characters ----- 
 
-   $string = str_replace("\r", '', $string);    // --- replace with empty space
 
-   $string = str_replace("\n", ' ', $string);   // --- replace with space
 
-   $string = str_replace("\t", ' ', $string);   // --- replace with space
 
-   
 
-   // $string = str_replace(" ", ' ', $string);   // --- replace with space
 
-   // $string = str_replace("'", '\'', $string);   // --- replace with space
 
-   // ----- remove multiple spaces ----- 
 
-   $string = trim(preg_replace('/ {2,}/', ' ', $string));
 
-   // ----- remove html entities
 
-   preg_match_all('/&[^;]+;/', $string, $entities);
 
-   foreach ($entities[0] as $entity) {
 
-     $string = str_replace($entity, mb_convert_encoding($entity, 'UTF-8', 'HTML-ENTITIES'), $string);
 
-   }
 
-   
 
-   return $string;
 
- }
 
- /**
 
-  * Implements hook_block_info().
 
-  */
 
- function materio_search_api_block_info() {
 
-   // This example comes from node.module.
 
-   $blocks['materio_search_api_search'] = array(
 
-     'info' => t('Materio search api search'),
 
-     'cache' => DRUPAL_NO_CACHE
 
-   );
 
-   $blocks['materio_search_api_viewmode'] = array(
 
-     'info' => t('Materio search api view mode selection'),
 
-     'cache' => DRUPAL_NO_CACHE
 
-   );
 
-   
 
-   // $blocks['materio_search_api_filters'] = array(
 
-   //   'info' => t('Materio search api filters'),
 
-   //   'cache' => DRUPAL_NO_CACHE
 
-   // );
 
-   return $blocks;
 
- }
 
- /**
 
-  * Implements hook_block_view().
 
-  */
 
- function materio_search_api_block_view($delta = '') {
 
-   // This example comes from node.module. Note that you can also return a
 
-   // renderable array rather than rendered HTML for 'content'.
 
-   $block = array();
 
-   switch ($delta) {
 
-     case 'materio_search_api_search':
 
-       if (user_access('use materio search api') || user_access('use materio search api for breves')) {
 
-         $block['subject'] = t('Search');
 
-         $block['content'] = theme('materio_search_api_search_block', array());
 
-       }
 
-       break;
 
-     case 'materio_search_api_viewmode':
 
-       if (user_access('use materio search api viewmode selection')) {
 
-         $block['subject'] = t('View mode');
 
-         $block['content'] = theme('materio_search_api_select_viewmode_block', array());
 
-       }
 
-       break;
 
-     // case 'materio_search_api_filters':
 
-     //   if (user_access('use materio search api filters')) {
 
-     //     $block['subject'] = t('Filters');
 
-     //     $block['content'] = theme('materio_search_api_filters_block', array());
 
-     //   }
 
-     //   break;
 
-   }
 
-   return $block;
 
- }
 
- /**
 
-  * Implements hook_entity_info_alter().
 
-  */
 
- function materio_search_api_entity_info_alter(&$entity_info) {
 
-   $entity_info['node']['view modes']['cardsmall'] = array(
 
-     'label' => t('Small cards'),
 
-     'custom settings' => TRUE,
 
-   );
 
-   
 
-   $entity_info['node']['view modes']['cardmedium'] = array(
 
-     'label' => t('Medium cards'),
 
-     'custom settings' => TRUE,
 
-   );
 
-   
 
-   $entity_info['node']['view modes']['cardbig'] = array(
 
-     'label' => t('Big cards'),
 
-     'custom settings' => TRUE,
 
-   );
 
-   $entity_info['node']['view modes']['cardfull'] = array(
 
-     'label' => t('Full cards'),
 
-     'custom settings' => TRUE,
 
-   );
 
- }
 
- /**
 
-  * Implements hook_node_view().
 
-  */
 
- function materio_search_api_node_view($node, $view_mode, $langcode) {
 
-   if (in_array($view_mode, array('cardsmall','cardmedium', 'cardbig', 'cardfull'))) {
 
-     # PRINT 7.1
 
-     print_node_view($node, 'full');
 
-     print_pdf_node_view($node, 'full');
 
-     # PRINT 7.2-beta
 
-     //print_ui_node_view($node, 'full');
 
-     // dsm($node, 'node');
 
-   }
 
- }
 
- /**
 
-  * materiobase_search_form()
 
-  */
 
- function materio_search_api_search_form($form, &$form_state){
 
-   //  dsm($form_state, 'form_state');
 
-   // dsm($form, 'form');
 
-   global $user;
 
-   $form = array();
 
-   $args = arg();
 
-   $path = array_shift($args);
 
-   $keys = implode('/', $args); 
 
-   $form['searchfield'] = array(
 
-     '#type' => 'textfield',
 
-     '#default_value' => $path == 'explore' ? $keys : "", // TODO:  set the search page path global or a variable in settings  
 
-     // '#value' => $keys,
 
-     '#autocomplete_path' => 'materiosearchapi/autocomplete/searchapi',
 
-     //'#autocomplete_path' => 'materiosearchapi/autocomplete/dbselect',
 
-     '#size' => 30,
 
-     '#maxlength' => 1024,
 
-   );
 
-   if(user_access('use materio search api filters')){
 
-     
 
-     $index = search_api_index_load(variable_get('mainsearchindex', -1));
 
-     $indexed_bundles = $index->options['data_alter_callbacks']['search_api_alter_bundle_filter']['settings']['bundles'];
 
-    
 
-     foreach ($indexed_bundles as $bundle) {
 
-       $bundles_options[$bundle] = $bundle;
 
-       $default_bundles[] = $bundle;
 
-     }
 
-     
 
-     $user_bundles_filter = isset($user->data['materiosearchapi_bundlesfilter']) ? $user->data['materiosearchapi_bundlesfilter'] : $default_bundles;
 
-     $form['bundles_filter'] = array(
 
-       '#type'=>'checkboxes',
 
-       '#options' => $bundles_options,
 
-       '#default_value' => $user_bundles_filter,
 
-       // '#attributes' => array('class'=>array('btn-group')),
 
-     );
 
-   }
 
-   
 
-   $form['create'] = array(
 
-     '#type' => 'image_button',
 
-     '#src' => drupal_get_path('module', 'materio_search_api') . '/images/search.png',
 
-     '#value' => t('Search'),
 
-   );
 
-   return $form;
 
- }
 
- function materio_search_api_search_form_validate($form, &$form_state){
 
-   // dsm($form, '$form');
 
-   // dsm($form_state, '$form_state');
 
-   // dsm(strlen($form_state['values']['searchfield']));
 
-   if (strlen(trim($form_state['values']['searchfield'])) <= 1) {
 
-     form_set_error('searchfield', 'Please enter at least 2 characters keyword.');
 
-   }
 
- }
 
- function materio_search_api_search_form_submit($form, &$form_state){
 
-   // dsm($form_state, 'form_state');
 
-   global $user;
 
-   if(user_access('use materio search api filters')){
 
-     foreach($form_state['values']['bundles_filter'] as $bundle => $value)
 
-       if($value)
 
-         $bundles[] = $bundle;
 
-     # if no filter checked we checked them all by default
 
-     if(!isset($bundles))
 
-       foreach($form_state['values']['bundles_filter'] as $bundle => $value)
 
-           $bundles[] = $bundle;
 
-   }else{
 
-     # if user have no access to filters
 
-     $index = search_api_index_load(variable_get('mainsearchindex', -1));
 
-     $indexed_bundles = $index->options['data_alter_callbacks']['search_api_alter_bundle_filter']['settings']['bundles'];
 
-    
 
-     foreach ($indexed_bundles as $bundle) {
 
-       $bundles[] = $bundle;
 
-     }
 
-   }
 
-   user_save($user, array("data"=>array('materiosearchapi_bundlesfilter' => $bundles)));
 
-   $form_state['redirect'] = 'explore/'.$form_state['values']['searchfield'];
 
- }
 
- /**
 
-  * viewmode
 
-  */
 
- function _materio_search_api_change_viewmode($vm){
 
-   // dsm($vm, '_materio_search_api_change_viewmode');
 
-   global $user;
 
-   // dsm($user, 'user');
 
-   $entity_infos = entity_get_info();
 
-   // dsm($entity_infos, 'entity_infos');
 
-   if (in_array($vm, variable_get('availableviewmodes', array()))) {
 
-     user_save($user, array("data"=>array('materiosearchapi_viewmode' => $vm)));
 
-     $rep = array('statut'=>'saved');
 
-   }else{
 
-     $rep = array('statut'=>'viewmode not allowed');
 
-   }
 
-   return $rep;
 
- }
 
- /**
 
- * - - - - - - - - - - - -  THEME  - - - - - - - - - - - - 
 
- */
 
- /**
 
-  * Implements hook_theme().
 
-  */
 
- function materio_search_api_theme($existing, $type, $theme, $path) {
 
-   return array(
 
-     'materio_search_api_search_block' => array(
 
-       'arguments' => array(),
 
-       'template' => 'materio-search-api-search-block',
 
-       'path' => drupal_get_path('module', 'materio_search_api').'/templates',
 
-     ),
 
-     'materio_search_api_select_viewmode_block' => array(
 
-       'arguments' => array(),
 
-       'template' => 'materio-search-api-select-viewmode-block',
 
-       'path' => drupal_get_path('module', 'materio_search_api').'/templates',
 
-     ),
 
-     // 'materio_search_api_filters_block' => array(
 
-     //   'arguments' => array(),
 
-     //   'template' => 'materio-search-api-filters-block',
 
-     //   'path' => drupal_get_path('module', 'materio_search_api').'/templates',
 
-     // ),
 
-     'materio_search_api_results' => array(
 
-       'arguments' => array(), 
 
-       'template' => 'materio-search-api-results',
 
-       'path' => drupal_get_path('module', 'materio_search_api').'/templates',
 
-       'variables' => array(
 
-         'index' => NULL,
 
-         'results' => array('result count' => 0),
 
-         'items' => array(),
 
-         'view_mode' => 'teaser',
 
-         'keys' => '',
 
-         // 'page_machine_name' => NULL,
 
-         'spellcheck' => NULL,
 
-         'pager' => NULL,
 
-       ),
 
-     ),
 
-     // 'materio_search_api_performance' => array(
 
-     //   'render element' => 'element',
 
-     // ),
 
-     'materio_search_api_actuality' => array(
 
-       'template' => 'materio-search-api-actuality',
 
-       'path' => drupal_get_path('module', 'materio_search_api').'/templates',
 
-       'arguments' => array(
 
-         'items' => array(),
 
-         'view_mode' => "teaser",
 
-         'pager' => NULL,
 
-         'count' => 0,
 
-       )
 
-     )
 
-   );
 
- }
 
- /**
 
-  * Implements theme for rendering search-performance
 
-  */
 
- // function theme_materio_search_api_performance($variables) {
 
- //   $element = array_shift($variables);
 
- //   return $element['#markup'];
 
- // }
 
- /**
 
-  * template_preprocess_materiobase_search_block();
 
-  */
 
- function template_preprocess_materio_search_api_search_block(&$vars){
 
-   // dsm($vars, '$vars');
 
-   $vars['searchform'] = drupal_get_form("materio_search_api_search_form");
 
- }
 
- function template_preprocess_materio_search_api_select_viewmode_block(&$vars){
 
-   global $user;
 
-   $active = isset($user->data['materiosearchapi_viewmode']) ? $user->data['materiosearchapi_viewmode'] : variable_get('defaultviewmode', 'full');
 
-   $availableviewmodes = variable_get('availableviewmodes', -1);
 
-   // dsm($availableviewmodes);
 
-   $entity_infos = entity_get_info();
 
-   // dsm($entity_infos, 'entity_infos');
 
-   
 
-   $content = '<div class="btn-group btn-group-vertical">';
 
-   foreach ($entity_infos['node']['view modes'] as $viewmode => $value) {
 
-     if(in_array($viewmode, $availableviewmodes)){
 
-       $link = l(
 
-         '<i class="icon-materio-viewmode-'.$viewmode.($active == $viewmode ? " active" : '').'"></i><span class="inner">'.$value['label'].'</span>',
 
-         'materiosearchapi/viewmode/change/'.$viewmode,
 
-         array(
 
-           'query' => drupal_get_destination(),
 
-           'html' => true,
 
-           'attributes' => array(
 
-             'class' => array(
 
-               'viewmode-link',
 
-               'viewmode-'.$viewmode,
 
-               $active == $viewmode ? " active" : ''
 
-             ),
 
-             'rel' => $viewmode
 
-           )
 
-         )
 
-       );
 
-       $content .= $link;
 
-     }
 
-   }
 
-   $content .= '</div>';
 
-   $vars['content'] = $content;
 
- }
 
- // function template_preprocess_materio_search_api_filters_block(&$vars){
 
- //   $index_machine_name = variable_get('mainsearchindex', -1);
 
- //   $index = search_api_index_load($index_machine_name);
 
- //   dsm($index, 'index');
 
- //   // $entity_infos = entity_get_info($index->item_type);
 
- //   // dsm($entity_infos, 'entity_infos');
 
- //   $indexed_bundles = $index->options['data_alter_callbacks']['search_api_alter_bundle_filter']['settings']['bundles'];
 
-   
 
- //   dsm($indexed_bundles, 'indexed_bundles');
 
-   
 
- //   $vars['content'] = drupal_get_form('materio_search_api_filters_form', $indexed_bundles);
 
- // }
 
- // function materio_search_api_filters_form($form, $form_state, $bundles){
 
- //   $form = array();
 
- //   dsm($bundles, 'bundles');
 
- //   foreach ($bundles as $bundle) {
 
- //     $form[$bundle . '_filter'] = array(
 
- //       '#type'=>'checkbox',
 
- //       '#default_value' => -1,
 
- //       '#title' => $bundle,
 
- //     );
 
- //   }
 
- //   return $form;
 
- // }
 
- /**
 
-  * Function for preprocessing the variables for the search_api_page_results
 
-  * template.
 
-  *
 
-  * @param array $variables
 
-  *   An associative array containing:
 
-  *   - $index: The index this search was executed on.
 
-  *   - $results: An array of search results, as returned by
 
-  *     SearchApiQueryInterface::execute().
 
-  *   - $keys: The keywords of the executed search.
 
-  *
 
-  * @see materio-search-api-results.tpl.php
 
-  */
 
- function template_preprocess_materio_search_api_results(array &$variables) {
 
-   // dsm($variables, '$variables');
 
-   $results = $variables['results'];
 
-   $keys = $variables['keys'];
 
-   // $variables['items'] = $variables['index']->loadItems(array_keys($variables['results']['results']));
 
-   $variables['result_count'] = $results['result count'];
 
-   $variables['sec'] = round($results['performance']['complete'], 3);
 
-   
 
-   if(isset($results['breves count'])){
 
-     $variables['search_performance'] = format_plural(
 
-       $results['breves count'],
 
-       'The search found 1 news ',
 
-       'The search found @count news '
 
-     );
 
-     $variables['search_performance'] .= format_plural(
 
-       $variables['result_count'] - $results['breves count'],
 
-       'with 1 associated matter.',
 
-       'with @count associated matters.'
 
-     );
 
-     $variables['search_performance'] .= format_plural(
 
-       $results['could results']['result count'],
 
-       ' You could find 1 result with a ',
 
-       ' You could find @count results with a '
 
-     );
 
-     $variables['search_performance'] .= l(t('full access to materiO\'.'), 'node/11187');
 
-   }else{
 
-     $variables['search_performance'] = format_plural(
 
-       // $results['result count'],
 
-       $variables['result_count'],
 
-       'The search found 1 result.',
 
-       'The search found @count results.'
 
-     );
 
-   }
 
-   //dsm($variables, 'variables');
 
- }
 
- function template_preprocess_materio_search_api_actuality(&$vars){
 
-   // dsm($vars, 'template_preprocess_materio_search_api_actuality | vars');
 
-   // $vars['actualities_infos'] = t('Actualities by materiO\'');
 
-   $vars['actualities_infos'] = t('');
 
- }
 
- /**
 
- * - - - - - - - - - - - -  SEARCH API PAGE  - - - - - - - - - - - - 
 
- */
 
- /**
 
-  * Implements hook_block_view_alter().
 
-  */
 
- function materio_search_api_block_view_alter(&$data, $block) {
 
-   // this alter prepopulate the search form provide by search_api_page
 
-   if ($block->module == 'search_api_page') {
 
-     $page = search_api_page_load($block->delta);
 
-     $item = menu_get_item();
 
-     
 
-     if (isset($page->path) && $page->path == $item['path']) {
 
-       $keys = arg(count(arg(NULL, $page->path)));
 
-       if ($keys) {
 
-         $data['content']['keys_' . $page->id]['#default_value'] = $keys;
 
-         $data['content']['keys_' . $page->id]['#value'] = $keys;
 
-       }
 
-     }
 
-   }
 
- }
 
 
  |