
-@agendas.each do |actu|




  -@event= Event.new(:skip_date => true,:stop_date => true, :start_at => (actu["start_at"]  != "0000-00-00 00:00:00" ? actu["start_at"] : "2010-01-01 00:00:00"),:stop_at => (actu["finished_at"]  != "0000-00-00 00:00:00" ? actu["finished_at"] : "2010-01-01 00:00:00"), :updated_at => actu["updated_at"], :created_at => actu["created_at"],:title => actu["title"],:description => HTMLEntities.new.decode(actu["description"]) )

  


  -if @event.save

  
  
    
    -content = ""
    -begin

      =@event.block.portlets << Portlet.create(:content => TextContent.new(:content => HTMLEntities.new.decode(actu["content"])))
    -rescue
  
  -else
    =debug @event.errors
        

 






-@album = Album.create(:name => "images actualité")




-@actualitees.each do |actu|

  -@article= Article.new(:enabled => true, :frontpage => true,:end_at => (actu["end_at"]  != "0000-00-00 00:00:00" ? actu["end_at"] : "2010-01-01 00:00:00"), :published_at => (actu["start_at"]  != "0000-00-00 00:00:00" ? actu["start_at"] : "2010-01-01 00:00:00"), :updated_at => actu["updated_at"], :created_at => actu["created_at"],:title => actu["title"],:description => HTMLEntities.new.decode(actu["description"]) )

  -begin
    -rep = false
    -rep = @article.save
  -rescue
    %h2 erreur
    =debug @article

  -if rep
    -content = ""
    -begin

      =@article.block.portlets << Portlet.create(:content => TextContent.new(:content => HTMLEntities.new.decode(actu["content"])))
    -rescue
      
        
  -@url = Rails.root.join("public", "system","images", actu["id"],"original",actu["image_file_name"])
  
  -if File.exist?(@url)
    
    =debug  File.open(@url)
    -@image_file = ImageFile.new(:file => File.open(@url))
    -@image_file.album_id = @album.id
    =debug @image_file.save
    -@article.image_file_id = @image_file.id
    -@article.save
 


-@blocks.each do |block|
  -if block["block_name_id"] == "1"
    -lang_page = @lang_pages[block["lang_page_id"].to_i]
    -page = @pages[lang_page["page_id"].to_i]



    -if page and lang_page
  
      -@menu_item= MenuItem.new(:id => page["id"].to_i,:position => page["position"].to_i,:enabled => true, :visible => true,:menu_id => 1,:archive_id => page["archive_id"], :archived_at => (page["archived_at"]  != "0000-00-00 00:00:00" ? page["archived_at"] : "2010-01-01 00:00:00"), :updated_at => page["updated_at"], :created_at => page["created_at"], :menu_content_type => "Page",:name => lang_page["menu_title"], :slug => lang_page["slug"], :parent_id => (page["parent_id"] != "NULL" ? page["parent_id"].to_i : nil), :archived => (page["archived"] != "NULL" ? true : nil))
  
  
  
  
      -content = Page.new(:title => HTMLEntities.new.decode(lang_page["title"]), :description => HTMLEntities.new.decode(lang_page["description"]), :keywords => HTMLEntities.new.decode(lang_page["keywords"]))
  
  
  
      -@menu_item.menu_content = content

      -if @menu_item.save!
        -content = ""
        -begin
      
          =@menu_item.menu_content.blocks[0].portlets << Portlet.new(:content => TextContent.new(:content => HTMLEntities.new.decode(block["content"])))
        -rescue
          %h1 
            ALERT
  
  
  

    =debug block

    =debug lang_page
    =debug page
-MenuItem.all.each do |mi|

  -if mi.created_at.year < 1980
    -mi.created_at = "2010-08-01"
    -mi.save 
  -mi.set_permalink
