/[drupal]/contributions/modules/fast_gallery/storageengine/default.storage.inc
ViewVC logotype

Diff of /contributions/modules/fast_gallery/storageengine/default.storage.inc

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

revision 1.4, Thu Nov 5 04:53:17 2009 UTC revision 1.5, Mon Nov 9 07:29:05 2009 UTC
# Line 2  Line 2 
2  //$Id:  //$Id:
3  include_once('Istorage.php');  include_once('Istorage.php');
4    
5    function fast_gallery_get_storage() {
6      return new DefaultStorage();
7    }
8    
9  class DefaultStorage implements Istorage {  class DefaultStorage implements Istorage {
10    /**    /**
11     * Return all images that are stored on a given path     * Return all images that are stored on a given path
# Line 30  class DefaultStorage implements Istorage Line 34  class DefaultStorage implements Istorage
34        $foid = $item['foid'];        $foid = $item['foid'];
35      }      }
36    
37        //get the folders
38      $row = db_query("SELECT folder FROM {fast_gallery_hierarchy} WHERE pid = :foid", array(':foid' => $foid), array('fetch' => PDO::FETCH_ASSOC));      $row = db_query("SELECT folder FROM {fast_gallery_hierarchy} WHERE pid = :foid", array(':foid' => $foid), array('fetch' => PDO::FETCH_ASSOC));
39      foreach ($row as $folder) {      foreach ($row as $folder) {
40        $return[] = new FGImage($folder['folder'], array('dir' => TRUE));        $return[] = new FGImage($folder['folder'], array('dir' => TRUE));
# Line 71  class DefaultStorage implements Istorage Line 76  class DefaultStorage implements Istorage
76        if ($count == 0) {        if ($count == 0) {
77    
78        }*/        }*/
79        drupal_write_record('fast_gallery', $file);  
80          //TODO: Files sollten nur einmal drin stehen!!!! Es kann nämlich vorkommen
81          //dass die ordner von zwei galerien sich überschneiden
82    
83          $exists = db_query("SELECT count(fid) as c FROM {fast_gallery} WHERE fid=:fid AND foid=:foid", array(':fid' => $file->fid, ':foid' => $file->foid))->fetchField();
84    
85          if ($exists == 0) {
86            drupal_write_record('fast_gallery', $file);
87          }
88    
89      }      }
90    }    }
# Line 120  class DefaultStorage implements Istorage Line 133  class DefaultStorage implements Istorage
133      return $ar[$image->getFolder()];      return $ar[$image->getFolder()];
134    }    }
135    
136    
137      /**
138       * (non-PHPdoc)
139       * @see sites/all/modules/fast_gallery/storageengine/Istorage#deleteFile($file)
140       */
141      public function deleteFile($file) {
142        db_query("DELETE FROM {fast_gallery} WHERE fid=:fid", array(':fid' => $file->fid));
143      }
144    
145  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.2