mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
Should finish the basic holiday management.
This commit is contained in:
parent
15ec83f520
commit
95bde96cef
@ -66,4 +66,5 @@
|
|||||||
$p->parse('yes','form_button');
|
$p->parse('yes','form_button');
|
||||||
|
|
||||||
$p->pparse('out','form');
|
$p->pparse('out','form');
|
||||||
|
$phpgw->common->phpgw_footer();
|
||||||
?>
|
?>
|
||||||
|
70
calendar/deletelocale.php
Executable file
70
calendar/deletelocale.php
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
<?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$ */
|
||||||
|
|
||||||
|
if(!$locale)
|
||||||
|
{
|
||||||
|
Header('Location: ' . $phpgw->link('/calendar/holiday_admin.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpgw_flags = Array(
|
||||||
|
'currentapp' => 'calendar',
|
||||||
|
'enable_nextmatchs_class' => True,
|
||||||
|
'admin_header' => True,
|
||||||
|
'noheader' => True,
|
||||||
|
'nonavbar' => True,
|
||||||
|
'noappheader' => True,
|
||||||
|
'noappfooter' => True,
|
||||||
|
'parent_page' => 'holiday_admin.php'
|
||||||
|
);
|
||||||
|
$phpgw_info['flags'] = $phpgw_flags;
|
||||||
|
include('../header.inc.php');
|
||||||
|
|
||||||
|
if(isset($yes) && $yes==True)
|
||||||
|
{
|
||||||
|
$phpgw->calendar->holidays->delete_locale($locale);
|
||||||
|
Header('Location: ' . $phpgw->link('/calendar/holiday_admin.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpgw->common->phpgw_header();
|
||||||
|
echo parse_navbar();
|
||||||
|
|
||||||
|
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||||
|
$templates = Array(
|
||||||
|
'form' => 'delete_common.tpl',
|
||||||
|
'form_button' => 'form_button_script.tpl'
|
||||||
|
);
|
||||||
|
$p->set_file($templates);
|
||||||
|
|
||||||
|
$p->set_var('messages',lang('Are you sure you want to delete this ?'));
|
||||||
|
|
||||||
|
$var = Array(
|
||||||
|
'action_url_button' => $phpgw->link('/calendar/holiday_admin.php'),
|
||||||
|
'action_text_button' => lang('No'),
|
||||||
|
'action_confirm_button' => '',
|
||||||
|
'action_extra_field' => ''
|
||||||
|
);
|
||||||
|
$p->set_var($var);
|
||||||
|
$p->parse('no','form_button');
|
||||||
|
|
||||||
|
$var = Array(
|
||||||
|
'action_url_button' => $phpgw->link('/calendar/deletelocale.php','locale='.$locale.'&yes=true'),
|
||||||
|
'action_text_button' => lang('Yes'),
|
||||||
|
'action_confirm_button' => '',
|
||||||
|
'action_extra_field' => ''
|
||||||
|
);
|
||||||
|
$p->set_var($var);
|
||||||
|
$p->parse('yes','form_button');
|
||||||
|
|
||||||
|
$p->pparse('out','form');
|
||||||
|
$phpgw->common->phpgw_footer();
|
||||||
|
?>
|
@ -15,6 +15,8 @@
|
|||||||
'currentapp' => 'calendar',
|
'currentapp' => 'calendar',
|
||||||
'enable_nextmatchs_class' => True,
|
'enable_nextmatchs_class' => True,
|
||||||
'admin_header' => True,
|
'admin_header' => True,
|
||||||
|
'noheader' => True,
|
||||||
|
'nonavbar' => True,
|
||||||
'noappheader' => True,
|
'noappheader' => True,
|
||||||
'noappfooter' => True,
|
'noappfooter' => True,
|
||||||
'parent_page' => 'holiday_admin.php'
|
'parent_page' => 'holiday_admin.php'
|
||||||
@ -27,25 +29,27 @@
|
|||||||
$start = 0;
|
$start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function country_total($query)
|
function country_total($locale,$query)
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
|
|
||||||
$querymethod='';
|
$querymethod='';
|
||||||
if($query)
|
if($query)
|
||||||
{
|
{
|
||||||
$querymethod = ' WHERE '.$query;
|
$querymethod = ' AND '.$query;
|
||||||
}
|
}
|
||||||
$phpgw->db->query("SELECT locale FROM phpgw_cal_holidays".$querymethod,__LINE__,__FILE__);
|
$phpgw->db->query("SELECT count(*) FROM phpgw_cal_holidays WHERE locale='".$locale."'".$querymethod,__LINE__,__FILE__);
|
||||||
$count = 0;
|
$phpgw->db->next_record();
|
||||||
while($phpgw->db->next_record())
|
return intval($phpgw->db->f(0));
|
||||||
{
|
// $count = 0;
|
||||||
$count++;
|
// while($phpgw->db->next_record())
|
||||||
}
|
// {
|
||||||
return $count;
|
// $count++;
|
||||||
|
// }
|
||||||
|
// return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_holiday_list($sort, $order, $query, $total)
|
function get_holiday_list($locale, $sort, $order, $query, $total)
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
|
|
||||||
@ -53,14 +57,14 @@
|
|||||||
|
|
||||||
if($query)
|
if($query)
|
||||||
{
|
{
|
||||||
$querymethod .= ' WHERE '.$query;
|
$querymethod .= ' AND '.$query;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($order)
|
if($order)
|
||||||
{
|
{
|
||||||
$querymethod .= ' ORDER BY '.$order;
|
$querymethod .= ' ORDER BY '.$order;
|
||||||
}
|
}
|
||||||
$phpgw->db->query("SELECT hol_id,name FROM phpgw_cal_holidays".$querymethod,__LINE__,__FILE__);
|
$phpgw->db->query("SELECT hol_id,name FROM phpgw_cal_holidays WHERE locale='".$locale."'".$querymethod,__LINE__,__FILE__);
|
||||||
while($phpgw->db->next_record())
|
while($phpgw->db->next_record())
|
||||||
{
|
{
|
||||||
$holiday[$phpgw->db->f('hol_id')] = $phpgw->strip_html($phpgw->db->f('name'));
|
$holiday[$phpgw->db->f('hol_id')] = $phpgw->strip_html($phpgw->db->f('name'));
|
||||||
@ -72,16 +76,20 @@
|
|||||||
{
|
{
|
||||||
$query = str_replace('=',"='",$query)."'";
|
$query = str_replace('=',"='",$query)."'";
|
||||||
}
|
}
|
||||||
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
|
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||||
$templates = Array(
|
$templates = Array(
|
||||||
'group' => 'groups.tpl'
|
'locale' => 'locales.tpl'
|
||||||
);
|
);
|
||||||
$p->set_file($templates);
|
$p->set_file($templates);
|
||||||
$p->set_block('group','list','list');
|
$p->set_block('locale','list','list');
|
||||||
$p->set_block('group','row','row');
|
$p->set_block('locale','row','row');
|
||||||
$p->set_block('group','row_empty','row_empty');
|
$p->set_block('locale','row_empty','row_empty');
|
||||||
|
|
||||||
$total = country_total($query);
|
$total = country_total($locale,$query);
|
||||||
|
if(!$total && !isset($query))
|
||||||
|
{
|
||||||
|
Header('Location: ' . $phpgw->link('/calendar/holiday_admin.php'));
|
||||||
|
}
|
||||||
|
|
||||||
$p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
$p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
||||||
|
|
||||||
@ -93,9 +101,9 @@
|
|||||||
$p->set_var('header_edit',lang('Edit'));
|
$p->set_var('header_edit',lang('Edit'));
|
||||||
$p->set_var('header_delete',lang('Delete'));
|
$p->set_var('header_delete',lang('Delete'));
|
||||||
|
|
||||||
$holidays = get_holiday_list($sort, $order, $query, $total);
|
$holidays = get_holiday_list($locale, $sort, $order, $query, $total);
|
||||||
|
|
||||||
if (! count($holidays))
|
if (!count($holidays))
|
||||||
{
|
{
|
||||||
$p->set_var('message',lang('No matchs found'));
|
$p->set_var('message',lang('No matchs found'));
|
||||||
$p->parse('rows','row_empty',True);
|
$p->parse('rows','row_empty',True);
|
||||||
@ -120,10 +128,14 @@
|
|||||||
$p->set_var('new_action',$phpgw->link('/calendar/editholiday.php','locale='.$locale.'&id=0'));
|
$p->set_var('new_action',$phpgw->link('/calendar/editholiday.php','locale='.$locale.'&id=0'));
|
||||||
$p->set_var('lang_add',lang('add'));
|
$p->set_var('lang_add',lang('add'));
|
||||||
|
|
||||||
|
$p->set_var('back_action',$phpgw->link('/calendar/holiday_admin.php'));
|
||||||
|
$p->set_var('lang_back',lang('Back'));
|
||||||
|
|
||||||
$p->set_var('search_action',$phpgw->link('/calendar/editlocale.php'));
|
$p->set_var('search_action',$phpgw->link('/calendar/editlocale.php'));
|
||||||
$p->set_var('lang_search',lang('search'));
|
$p->set_var('lang_search',lang('search'));
|
||||||
|
|
||||||
|
$phpgw->common->phpgw_header();
|
||||||
|
echo parse_navbar();
|
||||||
$p->pparse('out','list');
|
$p->pparse('out','list');
|
||||||
|
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$p->set_var('new_action',$phpgw->link('/calendar/new_locale.php'));
|
$p->set_var('new_action',$phpgw->link('/calendar/editholiday.php','id=0'));
|
||||||
$p->set_var("lang_add",lang('add'));
|
$p->set_var("lang_add",lang('add'));
|
||||||
|
|
||||||
$p->set_var('search_action',$phpgw->link('/calendar/holiday_admin.php'));
|
$p->set_var('search_action',$phpgw->link('/calendar/holiday_admin.php'));
|
||||||
|
@ -78,6 +78,12 @@ class calendar_holiday
|
|||||||
$this->db->query($sql,__LINE__,__FILE__);
|
$this->db->query($sql,__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delete_locale($locale)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM phpgw_cal_holidays WHERE locale='".$locale."'";
|
||||||
|
$this->db->query($sql,__LINE__,__FILE__);
|
||||||
|
}
|
||||||
|
|
||||||
function load_from_network($locale)
|
function load_from_network($locale)
|
||||||
{
|
{
|
||||||
global $phpgw_info, $HTTP_HOST, $SERVER_PORT;
|
global $phpgw_info, $HTTP_HOST, $SERVER_PORT;
|
||||||
|
55
calendar/templates/default/locales.tpl
Executable file
55
calendar/templates/default/locales.tpl
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
<!-- BEGIN list -->
|
||||||
|
<p>
|
||||||
|
<table border="0" width="45%" align="center">
|
||||||
|
<tr>
|
||||||
|
<td align="left">{left_next_matchs}</td>
|
||||||
|
<td align="center">{lang_groups}</td>
|
||||||
|
<td align="right">{right_next_matchs}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table border="0" width="45%" align="center">
|
||||||
|
<tr bgcolor="{th_bg}">
|
||||||
|
<td>{sort_name}</td>
|
||||||
|
<td>{header_edit}</td>
|
||||||
|
<td>{header_delete}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{rows}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table border="0" width="45%" align="center">
|
||||||
|
<tr>
|
||||||
|
<td align="left">
|
||||||
|
<form method="POST" action="{new_action}">
|
||||||
|
<input type="submit" value="{lang_add}">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<form method="POST" action="{back_action}">
|
||||||
|
<input type="submit" value="{lang_back}">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
<td align="right">{lang_search}
|
||||||
|
<form method="POST" action="{search_action}">
|
||||||
|
<input name="query">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- END list -->
|
||||||
|
|
||||||
|
<!-- BEGIN row -->
|
||||||
|
<tr bgcolor="{tr_color}">
|
||||||
|
<td>{group_name}</td>
|
||||||
|
<td width="5%">{edit_link}</td>
|
||||||
|
<td width="5%">{delete_link}</td>
|
||||||
|
</tr>
|
||||||
|
<!-- END row -->
|
||||||
|
|
||||||
|
<!-- BEGIN row_empty -->
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" align="center">{message}</td>
|
||||||
|
</tr>
|
||||||
|
<!-- END row_empty -->
|
Loading…
Reference in New Issue
Block a user