Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 965 /**
- 966 * Returns the node type from id notation.
- 967 */
- 968 function lefigaro_common_node_type_from_id_notation($id_notation) {
- 969 $result = mdg_api__request('general/descriptor?VERSION=1&ID_NOTATION=' . (int)$id_notation)->data;
- 970 $id_security_type = $result->getValue('ID_SECURITY_TYPE');
- 971
- 972 switch ($id_security_type) {
- 973 case 1: // name = 'Actions'
- 974 return 'societe';
- 975 case 9: // name = 'Indices'
- 976 return 'indice';
- 977 }
- 978 }
- 979
- 980 /**
- 981 * Returns the nid from id notation. Possibility to create new node.
- 982 */
- 983 function lefigaro_common_nid_from_id_notation($id_notation, $creation = FALSE) {
- 984 // We don't check for the existence of each field, because we might have
- 985 // created some nodes with incorrect node type for some reason.
- 986 if ($type = lefigaro_common_node_type_from_id_notation($id_notation)) {
- 987 switch ($type) {
- 988 case 'societe':
- 989 $node = lefigaro_xml__node_load('field_societe_id_notation', $id_notation);
- 990 break;
- 991 case 'indice':
- 992 $node = lefigaro_xml__node_load('field_indice_id_notation', $id_notation);
- 993 break;
- 994 }
- 995 if (!empty($node)) {
- 996 return $node->nid;
- 997 }
- 998 }
- 999 }
- 1000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement