Advertisement
jcisio

Untitled

Feb 8th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. 965 /**
  2. 966 * Returns the node type from id notation.
  3. 967 */
  4. 968 function lefigaro_common_node_type_from_id_notation($id_notation) {
  5. 969 $result = mdg_api__request('general/descriptor?VERSION=1&ID_NOTATION=' . (int)$id_notation)->data;
  6. 970 $id_security_type = $result->getValue('ID_SECURITY_TYPE');
  7. 971
  8. 972 switch ($id_security_type) {
  9. 973 case 1: // name = 'Actions'
  10. 974 return 'societe';
  11. 975 case 9: // name = 'Indices'
  12. 976 return 'indice';
  13. 977 }
  14. 978 }
  15. 979
  16. 980 /**
  17. 981 * Returns the nid from id notation. Possibility to create new node.
  18. 982 */
  19. 983 function lefigaro_common_nid_from_id_notation($id_notation, $creation = FALSE) {
  20. 984 // We don't check for the existence of each field, because we might have
  21. 985 // created some nodes with incorrect node type for some reason.
  22. 986 if ($type = lefigaro_common_node_type_from_id_notation($id_notation)) {
  23. 987 switch ($type) {
  24. 988 case 'societe':
  25. 989 $node = lefigaro_xml__node_load('field_societe_id_notation', $id_notation);
  26. 990 break;
  27. 991 case 'indice':
  28. 992 $node = lefigaro_xml__node_load('field_indice_id_notation', $id_notation);
  29. 993 break;
  30. 994 }
  31. 995 if (!empty($node)) {
  32. 996 return $node->nid;
  33. 997 }
  34. 998 }
  35. 999 }
  36. 1000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement