Changeset 729 for trunk/Modules


Ignore:
Timestamp:
Jan 12, 2015, 12:20:30 AM (10 years ago)
Author:
chronos
Message:
  • Added: Generic Scheduler module for running tasks on specified time and with specified period.
  • Added: System execution from command line using cmd.php entry point.
Location:
trunk/Modules
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Finance/Finance.php

    r728 r729  
    380380          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value` * `FinanceOperation`.`Direction`) FROM `FinanceOperation` '.
    381381          'WHERE `FinanceOperation`.`BankAccount`=#Id)'),
     382        'AutoImport' => array('Type' => 'Boolean', 'Caption' => 'Automaticky stahovat z banky', 'Default' => ''),
    382383      ),
    383384      'ItemActions' => array(
  • trunk/Modules/FinanceBankAPI/FinanceBankAPI.php

    r639 r729  
    44include_once(dirname(__FILE__).'/ImportPS.php');
    55include_once(dirname(__FILE__).'/ImportFio.php');
     6include_once(dirname(__FILE__).'/../Scheduler/Scheduler.php');
    67
    78class ModuleFinanceBankAPI extends AppModule
     
    1516    $this->License = 'GNU/GPLv3';
    1617    $this->Description = 'Communication through API to various banks, manual file import';
    17     $this->Dependencies = array('Finance');
     18    $this->Dependencies = array('Finance', 'Scheduler');
    1819  }
    1920
     
    5859
    5960    $this->System->RegisterPage(array('finance', 'import-api'), 'PageImportAPI');
    60     $this->System->RegisterPage(array('finance', 'import-soubor'), 'PageImportFile');
     61    $this->System->RegisterPage(array('finance', 'import-soubor'), 'PageImportFile');   
    6162  }
    6263
     
    8182  }
    8283}
     84
     85class ScheduleBankImport extends SchedulerTask
     86{
     87        function Execute()
     88        {
     89                $Output = '';
     90                $DbResult = $this->Database->select('FinanceBankAccount', 'Id', '(AutoImport=1) AND ((TimeEnd IS NULL) OR (TimeEnd > NOW()))');
     91                while($DbRow = $DbResult->fetch_assoc())
     92                {                       
     93                        $Page = new PageImportAPI($this->System);
     94                        $Output .= $Page->Show();
     95                }
     96                return($Output);
     97        }
     98}
  • trunk/Modules/User/User.php

    r711 r729  
    6666    $this->OnlineStateTimeout = 600; // in seconds
    6767    $this->PasswordHash = new PasswordHash();
     68    $this->User = array('Id' => null, 'Member' => null);
    6869  }
    6970
     
    694695  function TopBarCallback()
    695696  {
    696     if($this->System->User->User['Id'] == null)
     697    if($this->System->User->User['Id'] == null)
     698    {
    697699      $Output = '<a href="'.$this->System->Link('/user/?Action=LoginForm').'">Přihlášení</a> '.
    698700        '<a href="'.$this->System->Link('/user/?Action=UserRegister').'">Registrace</a>';
    699       else $Output = $this->System->User->User['Name'].
     701    } else
     702    {
     703        $Output = $this->System->User->User['Name'].
    700704        ' <a href="'.$this->System->Link('/user/?Action=UserMenu').'">Nabídka</a>'.
    701705        ' <a href="'.$this->System->Link('/user/?Action=Logout').'">Odhlásit</a>';
    702 //   <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>';
     706        //   <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>';
     707    }
    703708    return($Output);
    704709  }
Note: See TracChangeset for help on using the changeset viewer.