mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
sitemgr module for (yearly) planner
This commit is contained in:
parent
507bad0b92
commit
810539ba9d
@ -1145,9 +1145,8 @@ class calendar_uiviews extends calendar_ui
|
||||
static $tpl = False;
|
||||
if (!$tpl)
|
||||
{
|
||||
$tpl = $GLOBALS['egw']->template;
|
||||
$tpl = new Template(common::get_tpl_dir('calendar'));
|
||||
|
||||
$tpl->set_root($GLOBALS['egw']->common->get_tpl_dir('calendar'));
|
||||
$tpl->set_file('event_widget_t','event_widget.tpl');
|
||||
$tpl->set_block('event_widget_t','event_widget');
|
||||
$tpl->set_block('event_widget_t','event_widget_wholeday_on_top');
|
||||
@ -1294,17 +1293,44 @@ class calendar_uiviews extends calendar_ui
|
||||
$tpl->set_var('tooltip',html::tooltip($tooltip,False,array('BorderWidth'=>0,'Padding'=>0)));
|
||||
$html = $tpl->fp('out',$block);
|
||||
|
||||
$view_link = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'calendar.calendar_uiforms.edit','cal_id'=>$event['id'],'date'=>$this->bo->date2string($event['start'])));
|
||||
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if ($is_private || !$this->allowEdit)
|
||||
{
|
||||
$view_link_confirm_abort = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'calendar.calendar_uiforms.edit','cal_id'=>$event['id'],'date'=>$this->bo->date2string($event['start']),'exception'=>1));
|
||||
$view_link_confirm_text=lang('do you want to edit serialevent als exception? - Ok = Edit Exception, Abort = Edit Serial');
|
||||
$popup = ($is_private || ! $this->allowEdit) ? '' : ' onclick="'.$this->popup($view_link_confirm_abort,null,750,410,$view_link,$view_link_confirm_text).'; return false;"';
|
||||
$popup = '';
|
||||
}
|
||||
elseif(!is_numeric($event['id']))
|
||||
{
|
||||
$popup = '';
|
||||
if (preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches) &&
|
||||
($edit = egw_link::edit($matches[1],$matches[2],$popup_size)))
|
||||
{
|
||||
$view_link = egw::link('/index.php',$edit);
|
||||
|
||||
if ($popup_size)
|
||||
{
|
||||
list($w,$h) = explode('x',$popup_size);
|
||||
$popup = ' onclick="'.$this->popup($view_link,'_blank',$w,$h).'; return false;"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$popup = ' onclick="location.href=\''.$view_link.'\'; return false;"';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$popup = ($is_private || ! $this->allowEdit) ? '' : ' onclick="'.$this->popup($view_link).'; return false;"';
|
||||
$view_link = egw::link('/index.php',array('menuaction'=>'calendar.calendar_uiforms.edit','cal_id'=>$event['id'],'date'=>$this->bo->date2string($event['start'])));
|
||||
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
{
|
||||
$view_link_confirm_abort = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'calendar.calendar_uiforms.edit','cal_id'=>$event['id'],'date'=>$this->bo->date2string($event['start']),'exception'=>1));
|
||||
$view_link_confirm_text=lang('do you want to edit serialevent als exception? - Ok = Edit Exception, Abort = Edit Serial');
|
||||
$popup = ' onclick="'.$this->popup($view_link_confirm_abort,null,750,410,$view_link,$view_link_confirm_text).'; return false;"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$popup = ' onclick="'.$this->popup($view_link).'; return false;"';
|
||||
}
|
||||
}
|
||||
//_debug_array($event);
|
||||
|
||||
@ -1333,7 +1359,8 @@ class calendar_uiviews extends calendar_ui
|
||||
$this->wholeDayPosCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
{ $view_link = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'calendar.calendar_uiforms.edit','cal_id'=>$event['id'],'date'=>$this->bo->date2string($event['start'])));
|
||||
|
||||
$style = 'top: '.$this->time2pos($event['start_m']).'%; height: '.$height.'%;';
|
||||
}
|
||||
}
|
||||
@ -1353,7 +1380,7 @@ class calendar_uiviews extends calendar_ui
|
||||
// ATM we do not support whole day events or recurring events for dragdrop
|
||||
if (is_object($this->dragdrop) &&
|
||||
$this->use_time_grid &&
|
||||
$this->bo->check_perms(EGW_ACL_EDIT,$event) &&
|
||||
(int)$event['id'] && $this->bo->check_perms(EGW_ACL_EDIT,$event) &&
|
||||
!$event['whole_day_on_top'] &&
|
||||
!$event['whole_day'] &&
|
||||
!$event['recur_type']
|
||||
|
120
calendar/sitemgr/class.module_calendar_planner.inc.php
Normal file
120
calendar/sitemgr/class.module_calendar_planner.inc.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - Calendar planner block for sitemgr
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package calendar
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2010 by RalfBecker-At-outdoor-training.de
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calendar planner block for sitemgr
|
||||
*/
|
||||
class module_calendar_planner extends Module
|
||||
{
|
||||
/**
|
||||
* Default callendar CSS file
|
||||
*/
|
||||
const CALENDAR_CSS = '/calendar/templates/default/app.css';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->arguments = array(
|
||||
'sortby' => array(
|
||||
'type' => 'select',
|
||||
'label' => lang('Type of planner'),
|
||||
'options' => array(
|
||||
0 => lang('Planner by category'),
|
||||
'user' => lang('Planner by user'),
|
||||
'month' => lang('Yearly Planner'),
|
||||
'yearly' => lang('Yearly Planner').' ('.lang('initially year aligned').')',
|
||||
),
|
||||
),
|
||||
'cat_id' => array(
|
||||
'type' => 'select',
|
||||
'label' => lang('Choose a category'),
|
||||
'options' => array(), // done by get_user_interface()
|
||||
'multiple' => true,
|
||||
),
|
||||
'filter' => array(
|
||||
'type' => 'select',
|
||||
'label' => lang('Filter'),
|
||||
'options' => array(
|
||||
'default' => lang('Not rejected'),
|
||||
'accepted' => lang('Accepted'),
|
||||
'unknown' => lang('Invitations'),
|
||||
'tentative' => lang('Tentative'),
|
||||
'rejected' => lang('Rejected'),
|
||||
'owner' => lang('Owner too'),
|
||||
'all' => lang('All incl. rejected'),
|
||||
'hideprivate' => lang('Hide private infos'),
|
||||
'no-enum-groups' => lang('only group-events'),
|
||||
),
|
||||
'default' => 'default',
|
||||
),
|
||||
);
|
||||
$this->title = lang('Calendar - Planner');
|
||||
$this->description = lang('This module displays a planner calendar.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reimplemented to fetch the cats
|
||||
*/
|
||||
function get_user_interface()
|
||||
{
|
||||
$cats = new categories('','calendar');
|
||||
foreach($cats->return_array('all',0,False,'','cat_name','',True) as $cat)
|
||||
{
|
||||
$this->arguments['cat_id']['options'][$cat['id']] = str_repeat(' ',$cat['level']).$cat['name'];
|
||||
}
|
||||
if (count($cat_ids) > 5)
|
||||
{
|
||||
$this->arguments['cat_id']['multiple'] = 5;
|
||||
}
|
||||
return parent::get_user_interface();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block content
|
||||
*
|
||||
* @param $arguments
|
||||
* @param $properties
|
||||
*/
|
||||
function get_content(&$arguments,$properties)
|
||||
{
|
||||
translation::add_app('calendar');
|
||||
|
||||
$arguments['view'] = 'planner';
|
||||
if ($arguments['sortby'] == 'yearly')
|
||||
{
|
||||
$arguments['sortby'] = 'month';
|
||||
$arguments['date'] = date('Y0101');
|
||||
}
|
||||
if (isset($_GET['date'])) $arguments['date'] = $_GET['date'];
|
||||
if (empty($arguments['cat_id'])) $arguments['cat_id'] = 0;
|
||||
|
||||
$uiviews = new calendar_uiviews($arguments);
|
||||
$uiviews->allowEdit = false; // switches off all edit popups
|
||||
|
||||
$html = '<style type="text/css">'."\n";
|
||||
$html .= '@import url('.$GLOBALS['egw_info']['server']['webserver_url'].self::CALENDAR_CSS.");\n";
|
||||
$html .= '</style>'."\n";
|
||||
|
||||
// Initialize Tooltips
|
||||
static $wz_tooltips;
|
||||
if (!$wz_tooltips++) $html .= '<script language="JavaScript" type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/wz_tooltip/wz_tooltip.js"></script>'."\n";
|
||||
|
||||
// replacing egw-urls with sitemgr ones, allows to use navigation links
|
||||
$html .= str_replace($GLOBALS['egw_info']['server']['webserver_url'].'/index.php?',
|
||||
$this->link().'&',
|
||||
$uiviews->planner(true));
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user