2001-05-15 06:10:37 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
$phpgw_flags = Array(
|
|
|
|
'currentapp' => 'calendar',
|
|
|
|
'enable_nextmatchs_class' => True,
|
|
|
|
'admin_header' => True,
|
2001-05-19 05:24:36 +02:00
|
|
|
'noheader' => True,
|
|
|
|
'nonavbar' => True,
|
2001-05-15 06:10:37 +02:00
|
|
|
'noappheader' => True,
|
|
|
|
'noappfooter' => True,
|
|
|
|
'parent_page' => 'holiday_admin.php'
|
|
|
|
);
|
|
|
|
$phpgw_info['flags'] = $phpgw_flags;
|
|
|
|
include('../header.inc.php');
|
|
|
|
|
|
|
|
if(!isset($start))
|
|
|
|
{
|
|
|
|
$start = 0;
|
|
|
|
}
|
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
function country_total($locale,$query)
|
2001-05-15 06:10:37 +02:00
|
|
|
{
|
|
|
|
global $phpgw;
|
|
|
|
|
|
|
|
$querymethod='';
|
|
|
|
if($query)
|
|
|
|
{
|
2001-05-20 04:02:05 +02:00
|
|
|
$querymethod = " AND name like '%".$query."%'";
|
2001-05-15 06:10:37 +02:00
|
|
|
}
|
2001-05-19 05:24:36 +02:00
|
|
|
$phpgw->db->query("SELECT count(*) FROM phpgw_cal_holidays WHERE locale='".$locale."'".$querymethod,__LINE__,__FILE__);
|
|
|
|
$phpgw->db->next_record();
|
|
|
|
return intval($phpgw->db->f(0));
|
2001-05-15 06:10:37 +02:00
|
|
|
}
|
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
function get_holiday_list($locale, $sort, $order, $query, $total)
|
2001-05-15 06:10:37 +02:00
|
|
|
{
|
|
|
|
global $phpgw;
|
|
|
|
|
|
|
|
$querymethod = '';
|
|
|
|
|
|
|
|
if($query)
|
|
|
|
{
|
2001-05-20 04:02:05 +02:00
|
|
|
$querymethod = " AND name like '%".$query."%'";
|
2001-05-15 06:10:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if($order)
|
|
|
|
{
|
|
|
|
$querymethod .= ' ORDER BY '.$order;
|
|
|
|
}
|
2001-05-19 05:24:36 +02:00
|
|
|
$phpgw->db->query("SELECT hol_id,name FROM phpgw_cal_holidays WHERE locale='".$locale."'".$querymethod,__LINE__,__FILE__);
|
2001-05-15 06:10:37 +02:00
|
|
|
while($phpgw->db->next_record())
|
|
|
|
{
|
|
|
|
$holiday[$phpgw->db->f('hol_id')] = $phpgw->strip_html($phpgw->db->f('name'));
|
|
|
|
}
|
|
|
|
return $holiday;
|
|
|
|
}
|
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
2001-05-15 06:10:37 +02:00
|
|
|
$templates = Array(
|
2001-05-19 05:24:36 +02:00
|
|
|
'locale' => 'locales.tpl'
|
2001-05-15 06:10:37 +02:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-19 05:24:36 +02:00
|
|
|
$p->set_block('locale','list','list');
|
|
|
|
$p->set_block('locale','row','row');
|
|
|
|
$p->set_block('locale','row_empty','row_empty');
|
2001-05-15 06:10:37 +02:00
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
$total = country_total($locale,$query);
|
|
|
|
if(!$total && !isset($query))
|
|
|
|
{
|
|
|
|
Header('Location: ' . $phpgw->link('/calendar/holiday_admin.php'));
|
|
|
|
}
|
2001-05-15 06:10:37 +02:00
|
|
|
|
|
|
|
$p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
|
|
|
|
|
|
|
$p->set_var('left_next_matchs',$phpgw->nextmatchs->left('/calendar/'.basename($SCRIPT_FILENAME),$start,$total,'&locale='.$locale));
|
|
|
|
$p->set_var('right_next_matchs',$phpgw->nextmatchs->right('/calendar/'.basename($SCRIPT_FILENAME),$start,$total,'&locale='.$locale));
|
|
|
|
$p->set_var('lang_groups',lang('Holidays').' ('.$locale.')');
|
|
|
|
|
|
|
|
$p->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'name',$order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Holiday'),'&locale='.$locale));
|
|
|
|
$p->set_var('header_edit',lang('Edit'));
|
|
|
|
$p->set_var('header_delete',lang('Delete'));
|
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
$holidays = get_holiday_list($locale, $sort, $order, $query, $total);
|
2001-05-15 06:10:37 +02:00
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
if (!count($holidays))
|
2001-05-15 06:10:37 +02:00
|
|
|
{
|
|
|
|
$p->set_var('message',lang('No matchs found'));
|
|
|
|
$p->parse('rows','row_empty',True);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (list($index,$name) = each($holidays))
|
|
|
|
{
|
|
|
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$p->set_var('tr_color',$tr_color);
|
|
|
|
|
|
|
|
if (! $name) $name = ' ';
|
|
|
|
|
|
|
|
$p->set_var('group_name',$name);
|
|
|
|
$p->set_var('edit_link','<a href="' . $phpgw->link('/calendar/editholiday.php','locale='.$locale.'&id='.$index) . '"> ' . lang('Edit') . ' </a>');
|
|
|
|
$p->set_var('delete_link','<a href="' . $phpgw->link('/calendar/deleteholiday.php','locale='.$locale.'&id='.$index) . '"> ' . lang('Delete') . ' </a>');
|
|
|
|
$p->parse('rows','row',True);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-16 06:38:14 +02:00
|
|
|
$p->set_var('new_action',$phpgw->link('/calendar/editholiday.php','locale='.$locale.'&id=0'));
|
|
|
|
$p->set_var('lang_add',lang('add'));
|
2001-05-15 06:10:37 +02:00
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
$p->set_var('back_action',$phpgw->link('/calendar/holiday_admin.php'));
|
|
|
|
$p->set_var('lang_back',lang('Back'));
|
|
|
|
|
2001-05-20 04:02:05 +02:00
|
|
|
$p->set_var('search_action',$phpgw->link('/calendar/editlocale.php','locale='.$locale));
|
2001-05-15 06:10:37 +02:00
|
|
|
$p->set_var('lang_search',lang('search'));
|
|
|
|
|
2001-05-19 05:24:36 +02:00
|
|
|
$phpgw->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
2001-05-15 06:10:37 +02:00
|
|
|
$p->pparse('out','list');
|
|
|
|
$phpgw->common->phpgw_footer();
|
|
|
|
?>
|