Revize 389
Přidáno uživatelem Jiří Sviták před více než 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'engineer' => 'Technik',
|
||
'engineers' => 'Technici',
|
||
'entrance date' => 'Datum vstupu',
|
||
'entrance_date' => 'Datum vstupu',
|
||
'entrance fee' => 'Vstupní příspěvek',
|
||
'entrance fee have to be a number' => 'Vstupní příspěvk musí být číslo',
|
||
'entrance fee left' => 'Nedoplatek vstupního příspěvku',
|
||
... | ... | |
'language' => 'Jazyk',
|
||
'last time login' => 'Poslední čas přihlášení',
|
||
'leaving date' => 'Datum vystoupení',
|
||
'leaving_date' => 'Datum vystoupení',
|
||
'list of all confirmed works' => 'Seznam všech potvrzených prací',
|
||
'list of all invoices' => 'Seznam všech faktur',
|
||
'list of all members' => 'Seznam všech členů',
|
||
... | ... | |
'or' => 'nebo',
|
||
'order number' => 'Číslo objednávky',
|
||
'organization identifier' => 'IČO',
|
||
'organization_identifier' => 'IČO',
|
||
'origin account' => 'Zdrojový účet',
|
||
'original term' => 'Původní výraz',
|
||
'ospf area id' => 'OSPF area ID',
|
||
... | ... | |
'specific symbol' => 'Specifický symbol',
|
||
'start amount' => 'Počáteční částka',
|
||
'street number' => 'č.p.',
|
||
'street_number' => 'č.p.',
|
||
'street' => 'Ulice',
|
||
'subject' => 'Předmět',
|
||
'submit' => 'Odeslat',
|
freenetis/trunk/kohana/application/models/member.php | ||
---|---|---|
|
||
public function get_all_members_to_export()
|
||
{
|
||
return self::$db->query("SELECT *
|
||
FROM members");
|
||
return self::$db->query("SELECT m.id,
|
||
m.registration,
|
||
m.name,
|
||
m.street, m.street_number,
|
||
m.town, m.quarter,
|
||
u.phone, u.email, u.login, u.birthday,
|
||
m.entrance_date,
|
||
IF(m.leaving_date = '0000-00-00', null, m.leaving_date) AS leaving_date,
|
||
IFNULL(f.translated_term, e.value) AS type, m.comment
|
||
FROM members m
|
||
JOIN users u ON u.member_id = m.id AND u.type = ".User_Model::$member."
|
||
LEFT JOIN enum_types e ON m.type = e.id
|
||
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::item('locale.lang')."') f ON e.value = f.original_term");
|
||
}
|
||
|
||
/**
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
} // end of registration function
|
||
|
||
|
||
/**
|
||
* Export list of members to xls file. Requires library PEAR.
|
||
* @return unknown_type
|
||
*/
|
||
function xls_export()
|
||
{
|
||
// access rights
|
||
if (!$this->acl_check_view(get_class($this),'members'))
|
||
Controller::Error(1);
|
||
// set content header
|
||
header('Content-type: application/xls');
|
||
// requires xls module from library PEAR
|
||
require_once(APPPATH.'vendors/Spreadsheet/Excel/Writer.php');
|
||
// workbook represents xls file
|
||
$workbook = new Spreadsheet_Excel_Writer();
|
||
$workbook->send(url_lang::lang('texts.Members').'.xls');
|
||
$workbook->setVersion(8);
|
||
// set xls cells format
|
||
$format_bold =& $workbook->addFormat();
|
||
$format_bold->setBold();
|
||
// worksheet represents sheet in xls file
|
||
$worksheet =& $workbook->addWorksheet('Clenove');
|
||
$worksheet->setInputEncoding("UTF-8");
|
||
// creates database member model
|
||
$member_model = new Member_Model();
|
||
$members = $member_model->get_all_members_to_export();
|
||
$resultCnt = count($members);
|
||
$first = true;
|
||
$row = 0;
|
||
// yes and no for registration
|
||
$yes = url_lang::lang('texts.yes');
|
||
$no = url_lang::lang('texts.no');
|
||
// goes through rows of data
|
||
foreach ($members as $key => $line)
|
||
{
|
||
// get column count
|
||
$colCnt = count($line);
|
||
$col = 0;
|
||
// header is written only once
|
||
if ($first)
|
||
{
|
||
// foreach goes through columns of header
|
||
foreach ($line as $key => $value)
|
||
{
|
||
$valLen = strlen($value);
|
||
// max array stores lenghts of columns in xls sheet
|
||
$max[$key] = $valLen;
|
||
// writes header values
|
||
$worksheet->write(0, $col, url_lang::lang('texts.'.$key), $format_bold);
|
||
if ($col >= $colCnt-1)
|
||
$first = false;
|
||
// sets max size of cell
|
||
if ($row >= $resultCnt-1)
|
||
$worksheet->setColumn($col, $col, $max[$key]);
|
||
$col++;
|
||
}
|
||
$row++;
|
||
$colCnt = count($line);
|
||
$col = 0;
|
||
}
|
||
// goes through columns of data and writes them into the sheet
|
||
foreach ($line as $key => $value)
|
||
{
|
||
// special case - registration
|
||
if ($key == 'registration')
|
||
{
|
||
if ($value == 1)
|
||
$value = $yes;
|
||
else
|
||
$value = $no;
|
||
}
|
||
// determining size of cell
|
||
$valLen = strlen($value);
|
||
if ($max[$key] < $valLen)
|
||
$max[$key] = $valLen;
|
||
// writes data
|
||
$worksheet->write($row, $col, $value);
|
||
// sets max size of cell
|
||
if ($row >= $resultCnt)
|
||
$worksheet->setColumn($col, $col, $max[$key]);
|
||
$col++;
|
||
}
|
||
$row++;
|
||
}
|
||
$workbook->close();
|
||
} // end of xls_export
|
||
|
||
|
||
function get_streets()
|
||
{
|
||
... | ... | |
*/
|
||
}
|
||
|
||
/**
|
||
* Export list of members to xls file. Requires library PEAR.
|
||
* @return unknown_type
|
||
*/
|
||
function xls_export()
|
||
{
|
||
// checks access control
|
||
if (!$this->acl_check_view(get_class($this),'members'))
|
||
Controller::Error(1);
|
||
// requires xls module from library PEAR
|
||
require_once(APPPATH.'vendors/Spreadsheet/Excel/Writer.php');
|
||
// workbook represents xls file
|
||
$workbook = new Spreadsheet_Excel_Writer();
|
||
$workbook->send(url_lang::lang('texts.Members').'.xls');
|
||
$workbook->setVersion(8);
|
||
// sets xls cells format
|
||
$format_bold =& $workbook->addFormat();
|
||
$format_bold->setBold();
|
||
|
||
// worksheet represents sheet in xls file
|
||
$worksheet =& $workbook->addWorksheet('Clenove');
|
||
$worksheet->setInputEncoding("UTF-8");
|
||
|
||
// creates database member model
|
||
$member_model = new Member_Model();
|
||
$members = $member_model->get_all_members_to_export();
|
||
$resultCnt = count($members);
|
||
$first = true;
|
||
$row = 0;
|
||
|
||
// goes through rows of data
|
||
foreach ($members as $key => $line)
|
||
{
|
||
$colCnt = count($line);
|
||
$col = 0;
|
||
if ($first)
|
||
{
|
||
// goes through columns of header
|
||
foreach ($line as $key => $value)
|
||
{
|
||
$valLen = strlen($value);
|
||
// max array stores lenghts of columns in xls sheet
|
||
$max[$key] = $valLen;
|
||
// writes header
|
||
$worksheet->write(0, $col, url_lang::lang('texts.'.$key), $format_bold);
|
||
if ($col >= $colCnt-1)
|
||
$first = false;
|
||
if ($row>=$resultCnt-1)
|
||
$worksheet->setColumn($col, $col, $max[$key]);
|
||
$col++;
|
||
}
|
||
$row++;
|
||
$colCnt = count($line);
|
||
$col = 0;
|
||
}
|
||
// goes through columns of data and writes them into the sheet
|
||
foreach ($line as $key => $value)
|
||
{
|
||
$valLen = strlen($value);
|
||
if ($max[$key] < $valLen)
|
||
$max[$key] = $valLen;
|
||
// writes data
|
||
$worksheet->write($row, $col, $value);
|
||
if ($row >= $resultCnt)
|
||
$worksheet->setColumn($col, $col, $max[$key]);
|
||
$col++;
|
||
}
|
||
$row++;
|
||
}
|
||
$workbook->close();
|
||
//url::redirect(url_lang::base().'members/show_all');
|
||
}
|
||
}
|
||
?>
|
Také k dispozici: Unified diff
Upravy v xls exportu.