Revize 288
Přidáno uživatelem Michal Kliment před asi 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'fee has been successfully updated' => 'Poplatek byl úspěšně aktualizován',
|
||
'fee or penalty comment' => 'Komentář k poplatku/pokutě',
|
||
'fees' => 'Poplatky',
|
||
'fees have been successfully deducted' => 'Členské příspěvky byly úspěšně odečteny.',
|
||
'fees have been successfully deducted' => 'Členské příspěvky byly úspěšně odečteny.',
|
||
'file' => 'Soubor',
|
||
'file with bank transfer listing' => 'HTML soubor výpisem z Ebanky',
|
||
'filter' => 'Filtrovat',
|
||
'finances' => 'Finance',
|
||
... | ... | |
'iface' => 'Rozhraní',
|
||
'iface has not been selected' => 'Rozhraní nebylo vybráno.',
|
||
'ifaces' => 'Rozhraní',
|
||
'import new invoice' => 'Import nové faktury',
|
||
'in database can be only one infrastructure account' => 'V databázi může být pouze jeden účet infrastruktury.',
|
||
'in database can be only one master bank account' => 'V databázi může být pouze jeden hlavní bankovní účet',
|
||
'in database can be only one operating account' => 'V databázi může být pouze jeden operační účet.',
|
||
... | ... | |
'interval of interruption collides with another interruption of this member' => 'Interval přerušení koliduje s jiným přerušením tohoto člena',
|
||
'invalid ip address' => 'Chybná IP adresa',
|
||
'invalid network address' => 'Neplatná adresa sítě !',
|
||
'invoices' => 'Faktury',
|
||
'ip address' => 'IP adresa',
|
||
'ip address already exists' => 'IP adresa už existuje.',
|
||
'ip address detail' => 'Detail IP adresy',
|
freenetis/trunk/kohana/application/helpers/file.php | ||
---|---|---|
return ($piece - 1);
|
||
}
|
||
|
||
public static function extension($filename)
|
||
{
|
||
$p = explode('.',$filename);
|
||
return strtolower($p[count($p)-1]);
|
||
}
|
||
|
||
} // End file
|
freenetis/trunk/kohana/application/helpers/upload.php | ||
---|---|---|
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||
/**
|
||
* Upload helper class for working with the global $_FILES
|
||
* array and Validation library.
|
||
*
|
||
* $Id: upload.php 4134 2009-03-28 04:37:54Z zombor $
|
||
*
|
||
* @package Core
|
||
* @author Kohana Team
|
||
* @copyright (c) 2007-2008 Kohana Team
|
||
* @license http://kohanaphp.com/license.html
|
||
*/
|
||
class upload_Core {
|
||
|
||
/**
|
||
* Save an uploaded file to a new location.
|
||
*
|
||
* @param mixed name of $_FILE input or array of upload data
|
||
* @param string new filename
|
||
* @param string new directory
|
||
* @param integer chmod mask
|
||
* @return string full path to new file
|
||
*/
|
||
public static function save($file, $filename = NULL, $directory = NULL, $chmod = 0644)
|
||
{
|
||
// Load file data from FILES if not passed as array
|
||
$file = is_array($file) ? $file : $_FILES[$file];
|
||
|
||
if ($filename === NULL)
|
||
{
|
||
// Use the default filename, with a timestamp pre-pended
|
||
$filename = time().$file['name'];
|
||
}
|
||
|
||
if (config::item('upload.remove_spaces') === TRUE)
|
||
{
|
||
// Remove spaces from the filename
|
||
$filename = preg_replace('/\s+/', '_', $filename);
|
||
}
|
||
|
||
|
||
|
||
if ($directory === NULL)
|
||
{
|
||
// Use the pre-configured upload directory
|
||
$directory = config::item('upload.directory', TRUE);
|
||
}
|
||
|
||
// Make sure the directory ends with a slash
|
||
$directory = rtrim($directory, '/').'/';
|
||
|
||
if ( ! is_dir($directory) AND config::item('upload.create_directories') === TRUE)
|
||
{
|
||
// Create the upload directory
|
||
mkdir($directory, 0777, TRUE);
|
||
}
|
||
|
||
|
||
if ( ! is_writable($directory))
|
||
throw new Kohana_Exception('upload.not_writable', $directory);
|
||
|
||
if (is_uploaded_file($file['tmp_name']) AND move_uploaded_file($file['tmp_name'], $filename = $directory.$filename))
|
||
{
|
||
if ($chmod !== FALSE)
|
||
{
|
||
// Set permissions on filename
|
||
chmod($filename, $chmod);
|
||
}
|
||
|
||
// Return new file path
|
||
return $filename;
|
||
}
|
||
|
||
return FALSE;
|
||
}
|
||
|
||
/* Validation Rules */
|
||
|
||
/**
|
||
* Tests if input data is valid file type, even if no upload is present.
|
||
*
|
||
* @param array $_FILES item
|
||
* @return bool
|
||
*/
|
||
public static function valid($file)
|
||
{
|
||
return (is_array($file)
|
||
AND isset($file['error'])
|
||
AND isset($file['name'])
|
||
AND isset($file['type'])
|
||
AND isset($file['tmp_name'])
|
||
AND isset($file['size']));
|
||
}
|
||
|
||
/**
|
||
* Tests if input data has valid upload data.
|
||
*
|
||
* @param array $_FILES item
|
||
* @return bool
|
||
*/
|
||
public static function required(array $file)
|
||
{
|
||
return (isset($file['tmp_name'])
|
||
AND isset($file['error'])
|
||
AND is_uploaded_file($file['tmp_name'])
|
||
AND (int) $file['error'] === UPLOAD_ERR_OK);
|
||
}
|
||
|
||
/**
|
||
* Validation rule to test if an uploaded file is allowed by extension.
|
||
*
|
||
* @param array $_FILES item
|
||
* @param array allowed file extensions
|
||
* @return bool
|
||
*/
|
||
public static function type(array $file, array $allowed_types)
|
||
{
|
||
if ((int) $file['error'] !== UPLOAD_ERR_OK)
|
||
return TRUE;
|
||
|
||
// Get the default extension of the file
|
||
$extension = strtolower(substr(strrchr($file['name'], '.'), 1));
|
||
|
||
// Get the mime types for the extension
|
||
$mime_types = config::item('mimes.'.$extension);
|
||
|
||
// Make sure there is an extension, that the extension is allowed, and that mime types exist
|
||
return ( ! empty($extension) AND in_array($extension, $allowed_types) AND is_array($mime_types));
|
||
}
|
||
|
||
/**
|
||
* Validation rule to test if an uploaded file is allowed by file size.
|
||
* File sizes are defined as: SB, where S is the size (1, 15, 300, etc) and
|
||
* B is the byte modifier: (B)ytes, (K)ilobytes, (M)egabytes, (G)igabytes.
|
||
* Eg: to limit the size to 1MB or less, you would use "1M".
|
||
*
|
||
* @param array $_FILES item
|
||
* @param array maximum file size
|
||
* @return bool
|
||
*/
|
||
public static function size(array $file, array $size)
|
||
{
|
||
if ((int) $file['error'] !== UPLOAD_ERR_OK)
|
||
return TRUE;
|
||
|
||
// Only one size is allowed
|
||
$size = strtoupper($size[0]);
|
||
|
||
if ( ! preg_match('/[0-9]++[BKMG]/', $size))
|
||
return FALSE;
|
||
|
||
// Make the size into a power of 1024
|
||
switch (substr($size, -1))
|
||
{
|
||
case 'G': $size = intval($size) * pow(1024, 3); break;
|
||
case 'M': $size = intval($size) * pow(1024, 2); break;
|
||
case 'K': $size = intval($size) * pow(1024, 1); break;
|
||
default: $size = intval($size); break;
|
||
}
|
||
|
||
// Test that the file is under or equal to the max size
|
||
return ($file['size'] <= $size);
|
||
}
|
||
|
||
} // End upload
|
freenetis/trunk/kohana/application/config/upload.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||
/**
|
||
* @package Core
|
||
*
|
||
* This path is relative to your index file. Absolute paths are also supported.
|
||
*/
|
||
$config['directory'] = 'upload';
|
||
|
||
/**
|
||
* Remove spaces from uploaded filenames.
|
||
*/
|
||
$config['remove_spaces'] = TRUE;
|
freenetis/trunk/kohana/application/controllers/enum_types.php | ||
---|---|---|
where('read_only',0)->
|
||
orderby($order_by,$order_by_direction)->
|
||
find_all();
|
||
$total_enum_types = $enum_type_model->find_all()->count();
|
||
$total_enum_types = count($enum_types);
|
||
|
||
// create grid
|
||
$grid = new Grid(url_lang::base().'enum_types', url_lang::lang('texts.Enumerations'), array(
|
freenetis/trunk/kohana/application/controllers/invoices.php | ||
---|---|---|
<?php
|
||
class Invoices_Controller extends Controller {
|
||
|
||
|
||
function index()
|
||
{
|
||
url::redirect(url_lang::base().'invoices/import');
|
||
}
|
||
|
||
|
||
function import()
|
||
{
|
||
|
||
if ($_FILES)
|
||
{
|
||
$files = new Validation($_FILES);
|
||
$files->add_rules('file', 'upload::valid', 'upload::type[xml,html,pdf]', 'upload::size[1M]');
|
||
//$files->add_callbacks('file', array($this,'valid_invoice'));
|
||
|
||
if ($files->validate())
|
||
{
|
||
$filename = upload::save('file');
|
||
|
||
switch (file::extension($filename))
|
||
{
|
||
//case "html" :
|
||
// $parser = new PohodaInvoiceParser();
|
||
// break;
|
||
}
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
echo "ne ne";
|
||
}
|
||
|
||
}
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Import new invoice');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content = new View('invoices/import');
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
|
||
}
|
||
|
||
function valid_invoice()
|
||
{
|
||
|
||
}
|
||
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/libraries/MY_Controller.php | ||
---|---|---|
$acc_menu .= '<li>'.html::anchor(url_lang::base().'accounts/bank_accounts', url_lang::lang('texts.Bank accounts of association')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/credit_accounts', url_lang::lang('texts.Credit accounts')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/project_accounts', url_lang::lang('texts.Project accounts')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/cash_flow', url_lang::lang('texts.Cash flow')).'</li>';
|
||
<li>'.html::anchor(url_lang::base().'accounts/cash_flow', url_lang::lang('texts.Cash flow')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'invoices', url_lang::lang('texts.Invoices')).'</li>';
|
||
// commented by Jiri Svitak, it's probably useless
|
||
//<li>'.html::anchor(url_lang::base().'money_transfers', url_lang::lang('texts.Money transfers')).'</li>';
|
||
|
freenetis/trunk/kohana/application/views/invoices/import.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Import new invoice') ?></h2><br />
|
||
|
||
<?php echo form::open_multipart(url_lang::base().'invoices/import') ?>
|
||
<table cellspacing="3" class="form">
|
||
<tr>
|
||
<th><?php echo form::label('file',url_lang::lang('texts.File').':') ?></th>
|
||
<td><?php echo form::upload('file', ''); ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th></th>
|
||
<td><?php echo form::submit('submit', url_lang::lang('texts.Add'), ' class=submit') ?></td>
|
||
</tr>
|
||
</table>
|
||
<?php echo form::close() ?>
|
Také k dispozici: Unified diff
Opravena chybny pocet vsech vypsanych polozek u vyctovych typu. Pridan kontroler invoices pro praci s fakturama. Zatim pokus o implementaci importu.