<?php
	class cImportPage extends cAdminPage
	{ 
    private $menuItem;
    private $exchangeManager;
    
    function __construct( $smarty, $db, $action, $post, $get  )
    {
      parent::__construct( $smarty, $db, $action, $post, $get  );
      $this->menuItem = $this->menu->GetItemByLabel("Import");
      $this->menuItem->bSelected = true;
      $this->menuItem->bExpanded = true;
      $this->exchgManager = new cExchangeManager($this->db);
    }
		
    function Process()
    {
      switch ( $this->action )
      {
        case "do_uimport":    
          $this->error = $this->exchgManager->ImportUsers($importResult);
          if (!empty($this->error))
            return false;
          $this->smarty->assign("actionInfo","Import užívateľov prebehol úspešne.");
        break;

        case "do_cimport":
          $this->error = $this->exchgManager->ImportCourses($importResult);
          if (!empty($this->error))
            return false;
          $this->smarty->assign("actionInfo","Import predmetov prebehol úspešne.");
        break;
      }
        
      return true;
    }
    
    function Draw()
    {
      if ( $this->bPageSet == false )
      {
        $this->smarty->assign("content", "import.tpl");
        $this->smarty->assign( "title", "Import" );
      }
      parent::Draw();
    }
	}
?>
