le * Safran taxonomy share .module file */ DEFINE('BASE_TAXONOMY_API_PATH', '/taxonomy_share/rest_api'); /** * Implements hook_menu(). */ function safran_taxonomy_share_menu() { $items['admin/config/safran/taxonomy_share'] = array( 'title' => 'Taxonomy share configuration', 'access arguments' => array('access administration pages'), 'page callback' => 'drupal_get_form', 'page arguments' => array('safran_taxonomy_share_admin_form'), 'file' => 'safran_taxonomy_share.admin.inc', ); return $items; } function safran_taxonomy_share_cronapi($op, $job = NULL) { $items['safran_taxonomy_share_get_all_taxonomies'] = array( 'description' => 'string', 'rule' => '0 2 * * *', //once a day 'callback' => 'safran_taxonomy_share_get_taxonomies', ); return $items; } function safran_taxonomy_share_get_taxonomies() { safran_taxonomy_share_get_all_taxonomies(); safran_taxonomy_share_taxonomy_term_delete_from_hub(); } function safran_taxonomy_share_get_all_taxonomies() { $data = sts_call_hub(FALSE); if (!empty($data->result)) { // Get 'max_execution_time' from php.ini $phpMaxExecTime = ini_get('max_execution_time'); // Set 'max_execution_time' to unlimited ini_set('max_execution_time', 3600); safran_taxonomy_share_import_taxonomies($data->result); // Set 'max_execution_time' to initial value ini_set('max_execution_time', $phpMaxExecTime); } } function safran_taxonomy_share_get_taxonomie($voc) { $data = sts_call_hub(FALSE, $voc); if (!empty($data->result)) { // Get 'max_execution_time' from php.ini $phpMaxExecTime = ini_get('max_execution_time'); // Set 'max_execution_time' to unlimited ini_set('max_execution_time', 3600); safran_taxonomy_share_import_taxonomies($data->result); // Set 'max_execution_time' to initial value ini_set('max_execution_time', $phpMaxExecTime); } } function safran_taxonomy_share_taxonomy_term_delete_from_hub() { $data = sts_call_hub(TRUE); if (!empty($data->result)) { foreach ($data->result as $uuid) { entity_uuid_delete('taxonomy_term', $uuid); } } } function safran_taxonomy_share_import_taxonomies($data) { $language_list = language_list(); $language_list['und'] =array(); foreach ($data as $taxonomy) { $array_taxonomy = array(); foreach ($taxonomy as $key => $term) { $term = (object) $term; if (!empty($term->parent)) { foreach ($term->parent as &$parent) { if ($parent != 0) { $parent = (object) $parent; if (!empty($array_taxonomy[$parent->uuid])) { $parent = $array_taxonomy[$parent->uuid]; } else { if (array_key_exists($parent->language, $language_list)) { watchdog('Debug','
'.print_r($parent,true).'
'); $import = new ContentShareEntityImport($parent); $term_import = $import->execute(); $parent = $term_import; $array_taxonomy[$parent->uuid] = $term_import; } } } } } if (!isset($array_taxonomy[$term->uuid])) { if (array_key_exists($term->language, $language_list)) { watchdog('Debug','
'.print_r($term,true).'
'); $import = new ContentShareEntityImport($term); $term_import = $import->execute(); $array_taxonomy[$term->uuid] = $term_import; } } } } } function sts_get_hub_host() { $return = &drupal_static(__FUNCTION__); if (!isset($return)) { $host_protocol = variable_get('taxonomy_share_hub_protocol', 'https://'); //Just to be sure! $host = preg_replace("/^(http|https):\/\//", '', variable_get('taxonomy_share_hub_host')); $host = rtrim($host, '/'); $return = $host_protocol . $host; } return $return; } function sts_call_hub($delete, $voc = '') { $client = new ContentShareClient(''); if ($delete) { $host = sts_get_hub_host() . BASE_TAXONOMY_API_PATH . '/delete'; } else { $host = sts_get_hub_host() . BASE_TAXONOMY_API_PATH . '/all'; if (!empty($voc)) { $host .= '/' . $voc; } } $response = $client->call($host, GET); if (!empty($response->data) && $response->code == '200') { $data = (object) drupal_json_decode($response->data); } else { $data = array(); } return $data; } Herakles
  • Herakles
    Missile and rocket propulsion specialist
  • Herakles
    Center of excellence in thermostructural composites
  • Herakles
    Missile and rocket propulsion specialist
  • Herakles
    Center of excellence in thermostructural composites

Focus

Herakles
Missile and rocket propulsion specialist
Herakles
Center of excellence in thermostructural composites
Herakles
Missile and rocket propulsion specialist
Herakles
Center of excellence in thermostructural composites

Numbers

September

Sun Mon Tue Wed Thu Fri Sat
 
 
1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30
 
 
 
 
alt
03
Sep 2015