/[drupal]/contributions/modules/node_import/import_cck.inc
ViewVC logotype

Diff of /contributions/modules/node_import/import_cck.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7, Sat Apr 29 11:40:15 2006 UTC revision 1.8, Thu May 18 20:20:19 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /* $Id: import_flexinode.inc,v 1.5 2005/07/01 23:37:02 drumm Exp $ */  /* $Id$ */
3    
4    /**
5     * Implementation of hook_node_import_types().
6     */
7  function content_node_import_types() {  function content_node_import_types() {
8    $types = array();    $types = array();
9    foreach (_content_types() as $id => $type) {    foreach (_content_types() as $id => $type) {
# Line 9  function content_node_import_types() { Line 12  function content_node_import_types() {
12    return $types;    return $types;
13  }  }
14    
15    /**
16     * Implementation of hook_node_import_fields().
17     */
18  function content_node_import_fields($type) {  function content_node_import_fields($type) {
19    $types = (array)_content_types();    $types = (array)_content_types();
20    if (!isset($types[$type])) return;    if (!isset($types[$type])) return;
# Line 26  function content_node_import_fields($typ Line 32  function content_node_import_fields($typ
32    return $fields;    return $fields;
33  }  }
34    
35    /**
36     * Implementation of hook_node_import_prepare().
37     */
38  function content_node_import_prepare(&$node, $preview = FALSE) {  function content_node_import_prepare(&$node, $preview = FALSE) {
39    $types = _content_types();    $types = _content_types();
40    if (!isset($types[$node->type])) return;    if (!isset($types[$node->type])) return;
41    $content_type = $types[$node->type];    $content_type = $types[$node->type];
42    
43    //add all cck widget fields    //add all cck widget fields
44    foreach ($content_type->fields as $field) {    foreach ($content_type->fields as $field) {
45      if (strpos($field['widget']['type'], 'nodereference') === 0) {//nodereference node: query nid of the referenced node      if (strpos($field['widget']['type'], 'nodereference') === 0) {//nodereference node: query nid of the referenced node
46        $referenced_nodes = array();        $referenced_nodes = array();
47        $sql = "select nid, title from {node} where title sounds like '%s'";        $sql = "SELECT nid, title FROM {node} WHERE title SOUNDS LIKE '%s'";
48        $result = db_query($sql, $node->$field['field_name']);        $result = db_query($sql, $node->$field['field_name']);
49        $record_found = db_fetch_object($result);        $record_found = db_fetch_object($result);
50        if ($record_found) {        if ($record_found) {
# Line 54  function content_node_import_prepare(&$n Line 64  function content_node_import_prepare(&$n
64    }    }
65    return;    return;
66  }  }
 ?>  

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.2