2001-07-12 01:17:32 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - InfoLog *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
|
|
|
|
* originaly based on todo 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$ */
|
|
|
|
|
|
|
|
class uiinfolog // UI - User Interface - HTML
|
|
|
|
{
|
|
|
|
var $public_functions = array
|
|
|
|
(
|
|
|
|
'get_list' => True,
|
|
|
|
'view' => True,
|
|
|
|
'add' => True,
|
|
|
|
'edit' => True,
|
|
|
|
'delete' => True,
|
2001-07-14 17:49:04 +02:00
|
|
|
'preferences' => True
|
2001-07-12 01:17:32 +02:00
|
|
|
);
|
|
|
|
var $icons;
|
|
|
|
var $data;
|
|
|
|
var $enums;
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function uiinfolog( )
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw;
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->bo = CreateObject('infolog.boinfolog');
|
|
|
|
$this->data = &$this->bo->data;
|
|
|
|
$this->enums = &$this->bo->enums;
|
|
|
|
|
|
|
|
$this->icons = array(
|
|
|
|
'type' => array(
|
|
|
|
'task' => 'task.gif', 'task_alt' => 'Task',
|
|
|
|
'phone' => 'phone.gif', 'phone_alt' => 'Phonecall',
|
|
|
|
'note' => 'note.gif', 'note_alt' => 'Note',
|
|
|
|
'confirm' => 'confirm.gif','confirm_alt' => 'Confirmation',
|
|
|
|
'reject' => 'reject.gif', 'reject_alt' => 'Reject',
|
|
|
|
'email' => 'email.gif', 'email_alt' => 'Email' ),
|
|
|
|
'action' => array(
|
|
|
|
'new' => 'new.gif', 'new_alt' => 'Add Sub',
|
|
|
|
'view' => 'view.gif', 'view_alt' => 'View Subs',
|
|
|
|
'parent' => 'parent.gif', 'parent_alt' => 'View other Subs',
|
|
|
|
'edit' => 'edit.gif', 'edit_alt' => 'Edit',
|
|
|
|
'delete' => 'delete.gif', 'delete_alt' => 'Delete' ),
|
|
|
|
'status' => array(
|
|
|
|
'billed' => 'billed.gif', 'billed_alt' => 'billed',
|
|
|
|
'done' => 'done.gif', 'done_alt' => 'done',
|
|
|
|
'will-call' => 'will-call.gif', 'will-call_alt' => 'will-call',
|
|
|
|
'call' => 'call.gif', 'call_alt' => 'call',
|
|
|
|
'ongoing' => 'ongoing.gif','ongoing_alt' => 'ongoing',
|
|
|
|
'offer' => 'offer.gif', 'offer_alt' => 'offer' )
|
|
|
|
);
|
|
|
|
|
2001-07-15 23:42:17 +02:00
|
|
|
$this->filters = array(
|
|
|
|
'none' => lang('no Filter'),
|
|
|
|
'done' => lang('done'),
|
|
|
|
'own' => lang('own'),
|
|
|
|
'own+open+today' => lang('own open'),
|
|
|
|
'own+open+overdue'=> lang('own overdue'),
|
|
|
|
'own+upcoming' => lang('own upcoming'),
|
|
|
|
'open+today' => lang('open'),
|
|
|
|
'open+overdue' => lang('overdue'),
|
|
|
|
'upcoming' => lang('upcoming'),
|
|
|
|
);
|
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->html = CreateObject('infolog.html');
|
2001-07-13 01:39:02 +02:00
|
|
|
$this->template = CreateObject('phpgwapi.Template',
|
|
|
|
$phpgw->common->get_tpl_dir('infolog'));
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->categories = CreateObject('phpgwapi.categories');
|
|
|
|
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function menuaction($action = 'get_list')
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
return array( 'menuaction' => "infolog.uiinfolog.$action" );
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function icon($cat,$id,$status='')
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw,$DOCUMENT_ROOT;
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
$icons = &$this->icons[$cat];
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$status || !($icon = $icons[$id.'_'.$status])) {
|
2001-07-12 01:17:32 +02:00
|
|
|
$icon = $icons[$id];
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
if ($icon)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$fname = $phpgw->common->get_image_dir() . '/' . $icon;
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
if (!is_readable($fname))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$icon = False; // echo "<br>Can't read '$fname' !!!";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$icon = $phpgw->common->get_image_path() . '/' . $icon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!$status || !($alt = $icons[$id.'_'.$status.'_alt']))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if (!($alt = $icons[$id.'_alt']))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$alt = $id;
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
return ($icon ? "<img src='$icon' alt='" : '') . lang($alt) .
|
|
|
|
($icon ? '\' border=0>' : '');
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function setStyleSheet( )
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw;
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
return array (
|
|
|
|
'info_css' => '<link rel="stylesheet" type="text/css" href="'.
|
2001-07-14 23:44:01 +02:00
|
|
|
str_replace( '/images','',
|
|
|
|
$phpgw->common->get_image_path()).'/info.css">'
|
|
|
|
);
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* $info: info_id or array with one row form info-db
|
|
|
|
* no Proj.Info if proj_id == p_id / no Addr.Info if addr_id == a_id
|
|
|
|
*/
|
2001-07-14 23:44:01 +02:00
|
|
|
function formatInfo($info=0,$p_id=0,$a_id=0)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw,$phpgw_info;
|
|
|
|
|
|
|
|
if (!is_array($info) && (!$info ||
|
|
|
|
!is_array($info=$this->bo->read($info))))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$info = $this->data;
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
$done = $info['info_status'] == 'done' ||
|
|
|
|
$info['info_status'] == 'billed';
|
|
|
|
|
|
|
|
$css_class = $info['info_pri'].($done ? '_done' : '');
|
|
|
|
$subject = "<span class=$css_class>";
|
|
|
|
|
|
|
|
if ($p_id != ($proj_id = $info['info_proj_id']) &&
|
|
|
|
$proj = $this->bo->readProj($proj_id))
|
|
|
|
{
|
|
|
|
$subject .= $this->html->bold($this->html->a_href($proj['title'],
|
|
|
|
'/index.php',$this->menuaction()+
|
|
|
|
array( 'filter' => $filter,'action' => 'proj',
|
|
|
|
'proj_id' => $proj_id )));
|
|
|
|
}
|
|
|
|
if ($a_id != ($addr_id = $info['info_addr_id']) &&
|
|
|
|
$addr = $this->bo->readAddr($addr_id))
|
|
|
|
{
|
|
|
|
if ($proj) $subject .= '<br>';
|
|
|
|
$addr = $this->bo->addr2name( $addr );
|
2001-09-26 18:08:08 +02:00
|
|
|
$subject .= $this->html->bold($this->html->a_href($addr,'/index.php',
|
|
|
|
array( 'menuaction' => 'addressbook.uiaddressbook.view',
|
|
|
|
'ab_id' => $addr_id)
|
|
|
|
/* $this->menuaction() + array( 'filter' => $filter,'action' => 'addr',
|
|
|
|
'addr_id' => $addr_id )*/
|
|
|
|
));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if (($from = $info['info_from']) && (!$addr || !strstr($addr,$from)))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if ($addr) $subject .= '<br>';
|
|
|
|
$subject .= '<b>'.$from.'</b>';
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($info['info_addr'])
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if ($addr || $from) $subject .= ': ';
|
|
|
|
$subject .= $info['info_addr'];
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($proj || $addr || $from || $info['info_addr'])
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$subject .= '<br>';
|
|
|
|
}
|
|
|
|
$subject .= '<b>';
|
|
|
|
$subject .= $info['info_subject'] ? $info['info_subject'] :
|
|
|
|
substr($info['info_des'],0,60).' ...';
|
|
|
|
$subject .= '</b></span>';
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$info['info_enddate'])
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$enddate = ' ';
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$enddate = $phpgw->common->show_date($info['info_enddate'],
|
|
|
|
$phpgw_info['user']['preferences']['common']['dateformat']);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
if (!$done && $info['info_enddate'] < time()+(60*60)*$phpgw_info['user']['preferences']['common']['tz_offset'])
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$enddate = "<span class=overdue>$enddate</span>";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
if (!($responsible = $info['info_responsible']) &&
|
|
|
|
$info['info_status'] == 'offer')
|
|
|
|
{
|
|
|
|
$responsible = $this->icon('status','offer');
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$responsible = $this->bo->accountInfo($responsible);
|
|
|
|
}
|
|
|
|
$owner = $this->bo->accountInfo($info['info_owner']);
|
|
|
|
if ($info['info_access'] == 'private')
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$owner = "<span class=private>$owner</span>";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
return array(
|
|
|
|
'type' => $this->icon('type',$info['info_type']),
|
|
|
|
'status' => $this->icon('status',$info['info_status']),
|
|
|
|
'pri' => lang($info['info_pri']),
|
|
|
|
'subject' => $subject,
|
2001-07-19 03:03:36 +02:00
|
|
|
'des' => nl2br($info['info_des']),
|
2001-07-14 23:44:01 +02:00
|
|
|
'startdate' => $phpgw->common->show_date($info['info_startdate'],
|
|
|
|
$phpgw_info['user']['preferences']['common']['dateformat']),
|
2001-07-12 01:17:32 +02:00
|
|
|
'enddate' => $enddate,
|
|
|
|
'owner' => $owner,
|
2001-07-14 23:44:01 +02:00
|
|
|
'datecreated' => $phpgw->common->show_date($info['info_datecreated'] ,$phpgw_info['user']['preferences']['common']['dateformat']),
|
|
|
|
'responsible' => $responsible
|
|
|
|
);
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function infoHeaders( $do_sort_header=0,$sort=0,$order=0)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw,$phpgw_info;
|
|
|
|
|
|
|
|
$headers['th_bg'] = $phpgw_info['theme']['th_bg'];
|
|
|
|
|
2001-07-15 00:16:16 +02:00
|
|
|
$fields = array(
|
|
|
|
'type' => 'Type',
|
|
|
|
'status' => 'Status',
|
|
|
|
'urgency' => 'Urgency',
|
|
|
|
'subject' => 'Subject',
|
|
|
|
'startdate' => 'Startdate',
|
|
|
|
'enddate' => 'Enddate',
|
|
|
|
'owner' => 'Owner',
|
2001-07-15 01:51:51 +02:00
|
|
|
'datecreated' => 'last changed', // is MODIFICATION date now
|
2001-07-15 00:16:16 +02:00
|
|
|
'responsible' => 'Responsible'
|
|
|
|
);
|
|
|
|
while (list($f,$lang) = each($fields))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-15 00:16:16 +02:00
|
|
|
$lang = lang($lang);
|
2001-07-13 01:39:02 +02:00
|
|
|
$headers['lang_'.$f] = $do_sort_header ? $this->nextmatchs->show_sort_order($sort,'info_'.$f,$order,'/index.php',$lang,'&menuaction=infolog.uiinfolog.get_list') : $lang;
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
return $headers;
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function get_referer( )
|
|
|
|
{
|
2001-07-13 13:10:19 +02:00
|
|
|
global $phpgw_info,$HTTP_REFERER,$referer;
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
if (!$referer)
|
|
|
|
$referer = $HTTP_REFERER;
|
|
|
|
|
2001-07-14 11:14:28 +02:00
|
|
|
$url = parse_url(str_replace($phpgw_info['server']['webserver_url'],'',
|
|
|
|
$referer));
|
|
|
|
$referer = $url['path'];
|
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
if ($url['query'])
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-13 13:10:19 +02:00
|
|
|
$referer .= '?'.$url['query'];
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-13 13:10:19 +02:00
|
|
|
return $referer;
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function get_list($for_include=0)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw,$phpgw_info;
|
|
|
|
global $cat_filter,$cat_id,$sort,$order,$query,$start,$filter;
|
2001-07-14 00:23:33 +02:00
|
|
|
global $action,$addr_id,$proj_id,$info_id;
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-12 01:46:17 +02:00
|
|
|
if (!$for_include) {
|
|
|
|
$phpgw->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
$t = &$this->template; $html = &$this->html;
|
|
|
|
|
|
|
|
$t->set_file(array( 'info_list_t' => 'list.tpl' ));
|
|
|
|
$t->set_block('info_list_t','info_list','list');
|
|
|
|
|
|
|
|
if ($cat_filter) $cat_id = $cat_filter;
|
|
|
|
|
2001-07-15 23:42:17 +02:00
|
|
|
if (!$filter)
|
|
|
|
{
|
|
|
|
$filter = $phpgw_info['user']['preferences']['infolog']['defaultFilter'];
|
|
|
|
}
|
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
$hidden_vars = array(
|
|
|
|
'sort' => $sort,'order' => $order,'query' => $query,
|
|
|
|
'start' => $start,'filter' => $filter,'cat_id' => $cat_id
|
|
|
|
);
|
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
global $PHP_SELF,$QUERY_STRING; // set referer for form
|
|
|
|
$referer = $PHP_SELF.($QUERY_STRING ? '?'.$QUERY_STRING : '');
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 00:23:33 +02:00
|
|
|
$action_vars = array( 'action' => 'new' );
|
2001-07-14 23:44:01 +02:00
|
|
|
switch ($action)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
case 'sp': // Sub-List
|
2001-07-14 00:23:33 +02:00
|
|
|
$action_vars = array('action'=>'sp','info_id'=>$info_id);
|
2001-07-16 20:11:27 +02:00
|
|
|
$t->set_var(lang_info_action,lang('InfoLog - Subprojects from'));
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
case 'proj':
|
2001-07-14 23:44:01 +02:00
|
|
|
$action_vars += array( 'id_project' => $proj_id,
|
|
|
|
'proj_id' => $proj_id);
|
2001-07-12 01:17:32 +02:00
|
|
|
$proj = $this->bo->readProj($proj_id);
|
2001-09-26 15:08:11 +02:00
|
|
|
$t->set_var(lang_info_action,lang('InfoLog').' - '.
|
2001-07-14 23:44:01 +02:00
|
|
|
$proj['title']);
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
case 'addr':
|
2001-07-14 23:44:01 +02:00
|
|
|
$action_vars += array( 'id_addr' => $addr_id,
|
|
|
|
'addr_id' => $addr_id );
|
2001-07-12 01:17:32 +02:00
|
|
|
$addr = $this->bo->readAddr($addr_id);
|
2001-07-16 20:11:27 +02:00
|
|
|
$t->set_var(lang_info_action,lang('InfoLog').' - '.
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->bo->addr2name($addr));
|
|
|
|
break;
|
|
|
|
default:
|
2001-07-15 23:42:17 +02:00
|
|
|
if ($filter && $filter != 'none')
|
|
|
|
{
|
|
|
|
$filter_name = ': '.$this->filters[ $filter ];
|
|
|
|
}
|
2001-07-16 20:11:27 +02:00
|
|
|
$t->set_var(lang_info_action,lang('InfoLog').$filter_name);
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
2001-07-15 23:42:17 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var($this->setStyleSheet( ));
|
2001-07-14 00:23:33 +02:00
|
|
|
|
|
|
|
if (!$for_include)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-14 00:23:33 +02:00
|
|
|
$t->set_var('add_button',$html->form_1button('add_button','Add',
|
|
|
|
$hidden_vars+$action_vars+array('referer'=>$referer),
|
|
|
|
'/index.php',$this->menuaction('edit')));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-14 00:23:33 +02:00
|
|
|
$add_icons = lang('Add').':';
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
$icons = array( 'task' => True,
|
|
|
|
'phone' => True,
|
|
|
|
'note' => True
|
|
|
|
);
|
|
|
|
|
|
|
|
while (list($type,$nul) = each($icons))
|
|
|
|
{
|
2001-07-14 00:23:33 +02:00
|
|
|
$add_icons .= $html->a_href($this->icon('type',$type),'/index.php',
|
2001-07-14 23:44:01 +02:00
|
|
|
$this->menuaction('edit')+$action_vars+array('type'=>$type));
|
2001-07-14 00:23:33 +02:00
|
|
|
}
|
|
|
|
$t->set_var('add_icons',$add_icons);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
// ===========================================
|
|
|
|
// list header variable template-declarations
|
|
|
|
// ===========================================
|
2001-07-13 01:39:02 +02:00
|
|
|
$t->set_var( $this->infoHeaders( !$for_include,$sort,$order ));
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var(h_lang_sub,lang('Sub'));
|
|
|
|
$t->set_var(h_lang_action,lang('Action'));
|
|
|
|
// -------------- end header declaration -----------------
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
$ids = $this->bo->readIdArray($order,$sort,$filter,$cat_id,$query,
|
|
|
|
$action,$addr_id,$proj_id,$info_id,
|
|
|
|
$ordermethod,$start,$total);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$maxmatchs = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($total > $maxmatchs)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$to = $start + $maxmatchs;
|
|
|
|
if ($to > $total) $to = $total;
|
|
|
|
$total_matchs = lang('showing x - x of x',($start + 1),$to,$total);
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$total_matchs = lang('showing x',$total);
|
|
|
|
}
|
|
|
|
$t->set_var('total_matchs',$total_matchs);
|
|
|
|
|
|
|
|
// ==========================================
|
|
|
|
// project description if subprojectlist
|
|
|
|
// ==========================================
|
|
|
|
|
|
|
|
$t->set_block('info_list_t','projdetails','projdetailshandle');
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
switch ($action)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
case 'sp': // details of parent
|
|
|
|
$t->set_var( $this->infoHeaders( ));
|
|
|
|
$t->set_var( $this->formatInfo( $info_id ));
|
|
|
|
$t->parse('projdetailshandle','projdetails',True);
|
|
|
|
break;
|
|
|
|
case 'addr':
|
2001-07-13 13:10:19 +02:00
|
|
|
$nm_extra = "&addr_id=$addr_id";
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
case 'proj':
|
2001-07-13 13:10:19 +02:00
|
|
|
$nm_extra = "&proj_id=$proj_id";
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-07-14 02:24:02 +02:00
|
|
|
if (!$for_include || $total > $maxmatchs ||
|
2001-07-15 23:42:17 +02:00
|
|
|
$query || $cat_id)
|
2001-07-14 02:24:02 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
// ===========================================
|
|
|
|
// nextmatch variable template-declarations
|
|
|
|
// ===========================================
|
2001-07-14 02:24:02 +02:00
|
|
|
if (!($q_string = strstr($QUERY_STRING,'menuaction')))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-14 02:24:02 +02:00
|
|
|
$q_string = "menuaction=infolog.uiinfolog.get_list";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-14 02:24:02 +02:00
|
|
|
if (!strstr($q_string,'cat_id'))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-14 02:24:02 +02:00
|
|
|
$q_string .= "&cat_id=$cat_id";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-15 23:42:17 +02:00
|
|
|
while (list($f,$lang) = each ($this->filters))
|
|
|
|
{
|
|
|
|
$filters[] = array( $f,$lang );
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
$next_matchs = $this->nextmatchs->show_tpl('/index.php',$start,
|
2001-07-15 23:42:17 +02:00
|
|
|
$total,'&'.$q_string,'95%',$phpgw_info['theme']['th_bg'],
|
2001-09-26 15:08:11 +02:00
|
|
|
0,$filters,1,0,$cat_id,'cat_id');
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-13 01:39:02 +02:00
|
|
|
$t->set_var('next_matchs',$next_matchs);
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-13 01:39:02 +02:00
|
|
|
if ($total > $maxmatchs)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-13 01:39:02 +02:00
|
|
|
$t->set_var('next_matchs_end',$next_matchs);
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-13 01:39:02 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
// ---------- end nextmatch template --------------------
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
while (list($id,$parent) = each($ids))
|
|
|
|
{
|
|
|
|
$subproact = $this->bo->anzSubs($id);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$this->nextmatchs->template_alternate_row_color(&$t);
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var( $this->formatInfo( $id,$proj_id,$addr_id ));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($this->bo->check_access($id,PHPGW_ACL_EDIT))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('edit',$html->a_href(
|
|
|
|
$this->icon('action','edit'),'/index.php',
|
2001-07-14 23:44:01 +02:00
|
|
|
$hidden_vars+array('info_id' => $id)+
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->menuaction('edit')));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('edit','');
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($this->bo->check_access($id,PHPGW_ACL_DELETE))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('delete',$html->a_href(
|
2001-07-14 23:44:01 +02:00
|
|
|
$this->icon('action','delete'),'/index.php',
|
|
|
|
$hidden_vars+array('info_id' => $id)+
|
|
|
|
$this->menuaction('delete')));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('delete','');
|
|
|
|
}
|
|
|
|
$t->set_var('subadd', ''); // defaults no icons
|
|
|
|
$t->set_var('viewsub', '');
|
|
|
|
$t->set_var('viewparent', '');
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($subproact > 0) // if subprojects exist, display VIEW SUB icon
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('viewsub', $html->a_href(
|
|
|
|
$this->icon('action','view'),'/index.php',
|
2001-07-14 23:44:01 +02:00
|
|
|
$this->menuaction()+array( 'info_id' => $id,
|
2001-07-12 01:17:32 +02:00
|
|
|
'filter' => $filter, 'action' => 'sp')));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else // else display ADD SUB-Icon
|
|
|
|
{
|
|
|
|
if ($this->bo->check_access($id,PHPGW_ACL_ADD))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('subadd',$html->a_href(
|
|
|
|
$this->icon('action','new'),'/index.php',
|
|
|
|
$this->menuaction('edit')+
|
2001-07-14 23:44:01 +02:00
|
|
|
array('info_id' => $id,'filter' => $filter,
|
2001-07-12 01:17:32 +02:00
|
|
|
'action' => 'sp')));
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
} // if parent --> display VIEW SUBS of Parent
|
|
|
|
if ($parent && $action != 'sp')
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('viewparent',$html->a_href(
|
|
|
|
$this->icon('action','parent'),'/index.php',
|
|
|
|
$this->menuaction()+
|
2001-07-14 23:44:01 +02:00
|
|
|
array('info_id' => $parent,
|
2001-07-12 01:17:32 +02:00
|
|
|
'filter' => $filter,'action' => 'sp')));
|
|
|
|
}
|
|
|
|
|
|
|
|
$t->parse('list','info_list',True);
|
|
|
|
// -------------- end record declaration ------------------------
|
|
|
|
}
|
|
|
|
|
|
|
|
// =========================================================
|
|
|
|
// back2project list href declaration for subproject list
|
|
|
|
// =========================================================
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($action && !$for_include)
|
|
|
|
{
|
2001-07-14 00:23:33 +02:00
|
|
|
$t->set_var('back2projects',
|
2001-07-14 23:44:01 +02:00
|
|
|
$html->form_1button('back','Back to Projectlist','',
|
|
|
|
'/index.php',$this->menuaction()+array('filter'=>$filter)));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$t->pfp('out','info_list_t',true);
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function edit( )
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw,$phpgw_info;
|
|
|
|
global $cat_id,$sort,$order,$query,$start,$filter;
|
|
|
|
global $action,$info_id,$save,$add,$query_addr,$query_project;
|
|
|
|
// formular fields
|
|
|
|
global $selfortoday,$sday,$smonth,$syear;
|
|
|
|
global $dur_days,$eday,$emonth,$eyear;
|
|
|
|
global $type,$from,$addr,$id_addr,$id_project,$subject,$des,$access;
|
|
|
|
global $pri,$status,$confirm,$info_cat,$id_parent,$responsible;
|
|
|
|
|
|
|
|
$t = &$this->template; $html = &$this->html;
|
|
|
|
|
|
|
|
$hidden_vars = array('sort' => $sort,'order' => $order,
|
|
|
|
'query' => $query,'start' => $start,
|
|
|
|
'filter' => $filter,'cat_id' => $cat_id );
|
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
$referer = $this->get_referer();
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ((!isset($info_id) || !$info_id) && !$action)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
Header('Location: ' .
|
|
|
|
$html->link('/index.php',$hidden_vars+$this->menuaction()));
|
|
|
|
}
|
|
|
|
|
|
|
|
// check wether to write dates or not
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($selfortoday)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$startdate = time(); // startdate is today (checkbox is clicked)
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($sday)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if ($sday && !$smonth) $smonth = date('m',time());
|
|
|
|
if ($sday && !$syear) $syear = date('Y',time());
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
if (! checkdate($smonth,$sday,$syear))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$error[] = lang('You have entered an invalid starting date');
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$startdate = mktime(12,0,0,$smonth, $sday, $syear);
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isset($sday)) $startdate = 0;
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check ending date
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($dur_days > 0)
|
|
|
|
{
|
|
|
|
$enddate = mktime(12,0,0,date('m',$startdate),
|
|
|
|
date('d',$startdate)+$dur_days, date('Y',$startdate));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($eday)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if ($eday && !$emonth) $emonth = date('m',time());
|
|
|
|
if ($eday && !$eyear) $eyear = date('Y',time());
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
if (!checkdate($emonth,$eday,$eyear))
|
|
|
|
{
|
2001-07-16 20:11:27 +02:00
|
|
|
$error[] = lang('You have entered an invalid enddate');
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$enddate = mktime(12,0,0,$emonth,$eday,$eyear);
|
|
|
|
}
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isset($eday)) $enddate = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($save || $add) // form submited
|
|
|
|
{
|
|
|
|
if (strlen($des) >= 8000)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$error[] = lang('Description can not exceed 8000 characters in length');
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$subject && !$des)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$error[] = lang('You must enter a subject or a description');
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($enddate < $startdate && $enddate && $startdate)
|
|
|
|
{
|
2001-07-16 20:11:27 +02:00
|
|
|
$error[] = lang('Enddate can not be before startdate');
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
$access = $access ? 'private' : 'public';
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (! is_array($error))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->bo->write(array(
|
|
|
|
'type' => $type,
|
|
|
|
'from' => $from,
|
|
|
|
'addr' => $addr,
|
|
|
|
'addr_id' => $id_addr,
|
|
|
|
'proj_id' => $id_project,
|
|
|
|
'subject' => $subject,
|
|
|
|
'des' => $des,
|
|
|
|
'pri' => $pri,
|
|
|
|
'status' => $status,
|
|
|
|
'confirm' => $confirm,
|
|
|
|
'access' => $access,
|
|
|
|
'cat' => $info_cat,
|
|
|
|
'startdate' => $startdate,
|
|
|
|
'enddate' => $enddate,
|
|
|
|
'info_id' => $info_id,
|
|
|
|
'id_parent' => $id_parent,
|
|
|
|
'responsible' => $responsible
|
|
|
|
));
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$query_addr && !$query_project)
|
|
|
|
{
|
2001-07-13 13:10:19 +02:00
|
|
|
Header('Location: ' . $html->link($referer, array('cd'=>15)));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->bo->read( $info_id );
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
if ($info_id && $action == 'sp') // new SubProject
|
|
|
|
{
|
|
|
|
if (!$this->bo->check_access($info_id,PHPGW_ACL_ADD))
|
|
|
|
{
|
2001-07-13 13:10:19 +02:00
|
|
|
Header('Location: ' . $html->link($referer));
|
2001-07-12 01:17:32 +02:00
|
|
|
$phpgw->common->phpgw_exit();
|
|
|
|
}
|
|
|
|
$parent = $this->data;
|
|
|
|
$this->data['info_id'] = $info_id = 0;
|
|
|
|
$this->data['info_owner'] = $phpgw_info['user']['account_id'];
|
|
|
|
$this->data['info_id_parent'] = $parent['info_id'];
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($parent['info_type']=='task' && $parent['info_status']=='offer')
|
|
|
|
{
|
|
|
|
$this->data['info_type'] = 'confirm'; // confirmation to parent
|
|
|
|
$this->data['info_responsible'] = $parent['info_owner'];
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
$this->data['info_status'] = 'ongoing';
|
|
|
|
$this->data['info_confirm'] = 'not';
|
2001-07-14 23:44:01 +02:00
|
|
|
$this->data['info_subject']=lang('Re:').' '.$parent['info_subject'];
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->data['info_des'] = '';
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
|
|
|
|
{
|
2001-07-13 13:10:19 +02:00
|
|
|
Header('Location: ' . $html->link($referer));
|
2001-07-12 01:17:32 +02:00
|
|
|
$phpgw->common->phpgw_exit();
|
|
|
|
}
|
|
|
|
}
|
2001-07-19 01:09:11 +02:00
|
|
|
if (!$id_parent)
|
|
|
|
$id_parent = $this->data['info_id_parent'];
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
$common_hidden_vars = $html->input_hidden( $hidden_vars + array(
|
|
|
|
'info_id' => $info_id,
|
|
|
|
'action' => $action,
|
|
|
|
'id_parent' => $id_parent,
|
|
|
|
'referer' => $referer
|
|
|
|
));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$phpgw->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
|
|
|
|
|
|
|
$t->set_file(array('info_edit' => 'form.tpl'));
|
|
|
|
|
|
|
|
// ====================================================================
|
|
|
|
// create two seperate blocks, addblock will be cut off from template
|
|
|
|
// editblock contains the buttons and forms for edit
|
|
|
|
// ====================================================================
|
|
|
|
$t->set_block('info_edit', 'add', 'addhandle');
|
|
|
|
$t->set_block('info_edit', 'edit', 'edithandle');
|
|
|
|
$t->set_block('info_edit', 'subpro', 'subprohandle');
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (is_array($error))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('error_list',$phpgw->common->error_list($error));
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
switch ($action)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
case 'sp':
|
2001-07-16 20:11:27 +02:00
|
|
|
$info_action = 'InfoLog - New Subproject';
|
2001-07-14 23:44:01 +02:00
|
|
|
break;
|
2001-07-13 01:39:02 +02:00
|
|
|
case 'new': case 'addr': case 'proj':
|
2001-07-16 20:11:27 +02:00
|
|
|
$info_action = 'InfoLog - New';
|
2001-07-12 01:17:32 +02:00
|
|
|
if ($info_type && isset($this->enums['type'][$info_type]))
|
|
|
|
$this->data['info_type'] = $info_type;
|
|
|
|
break;
|
|
|
|
default:
|
2001-07-16 20:11:27 +02:00
|
|
|
$info_action = 'InfoLog - Edit'; break;
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('lang_info_action',lang($info_action) .
|
|
|
|
($query_addr ? ' - '.lang('Search for:')." '$query_addr'" : ''));
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var($this->setStyleSheet( ));
|
|
|
|
$t->set_var('lang_category',lang('Category'));
|
|
|
|
$t->set_var('lang_none',lang('None'));
|
|
|
|
if (!isset($info_cat)) $info_cat = $this->data['info_cat'];
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('cat_list',$this->categories->formated_list('select',
|
|
|
|
'all',$info_cat,'True'));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$t->set_var('actionurl',$html->link('/index.php',
|
|
|
|
$this->menuaction('edit')));
|
|
|
|
$t->set_var('common_hidden_vars',$common_hidden_vars);
|
|
|
|
|
|
|
|
// get an instance of select box class
|
|
|
|
$sb = CreateObject('phpgwapi.sbox2');
|
|
|
|
|
|
|
|
$t->set_var('lang_owner',lang('Owner'));
|
|
|
|
$t->set_var('owner_info',$sb->accountInfo($this->data['info_owner']));
|
|
|
|
|
|
|
|
$t->set_var('lang_type',lang('Type'));
|
|
|
|
if (!isset($type)) $type = $this->data['info_type'];
|
2001-07-19 03:28:16 +02:00
|
|
|
if (!$type) $type = 'note';
|
|
|
|
$t->set_var('type_list',$html->sbox_submit($sb->getArrayItem(
|
|
|
|
'type',$type,$this->enums['type']),True));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$t->set_var('lang_prfrom', lang('From'));
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!isset($from)) $from =$phpgw->strip_html($this->data['info_from']);
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('fromval', $from);
|
|
|
|
|
|
|
|
$t->set_var('lang_praddr', lang('Phone/Email'));
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!isset($addr)) $addr =$phpgw->strip_html($this->data['info_addr']);
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('addrval', $addr);
|
|
|
|
|
|
|
|
if (!isset($id_project)) $id_project = $this->data['info_proj_id'];
|
|
|
|
$t->set_var($sb->getProject('project',$id_project,$query_project));
|
|
|
|
|
|
|
|
if (!isset($id_addr)) $id_addr = $this->data['info_addr_id'];
|
|
|
|
$t->set_var($sb->getAddress('addr',$id_addr,$query_addr));
|
|
|
|
|
|
|
|
$t->set_var('lang_prsubject', lang('Subject'));
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!isset($subject)) {
|
|
|
|
$subject = $phpgw->strip_html($this->data['info_subject']);
|
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('subjectval', $subject);
|
|
|
|
|
|
|
|
$t->set_var('lang_prdesc', lang('Description'));
|
|
|
|
if (!isset($des)) $des = $phpgw->strip_html($this->data['info_des']);
|
|
|
|
$t->set_var('descval', $des);
|
|
|
|
|
2001-07-16 20:11:27 +02:00
|
|
|
$t->set_var('lang_start_date',lang('Startdate'));
|
2001-07-12 01:17:32 +02:00
|
|
|
if (!isset($startdate)) $startdate = $this->data['info_startdate'];
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('start_select_date',
|
|
|
|
$sb->getDate('syear','smonth','sday',$startdate));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-16 20:11:27 +02:00
|
|
|
$t->set_var('lang_end_date',lang('Enddate'));
|
2001-07-12 01:17:32 +02:00
|
|
|
if (!isset($enddate)) $enddate = $this->data['info_enddate'];
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('end_select_date',
|
|
|
|
$sb->getDate('eyear','emonth','eday',$enddate));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$t->set_var('lang_selfortoday',lang('Today'));
|
|
|
|
$t->set_var('selfortoday',$html->checkbox('selfortoday',0));
|
|
|
|
$t->set_var('lang_dur_days',lang('Duration'));
|
|
|
|
$t->set_var('days',lang('days'));
|
|
|
|
|
|
|
|
$t->set_var('lang_status',lang('Status'));
|
|
|
|
if (!isset($status)) $status = $this->data['info_status'];
|
2001-07-19 03:28:16 +02:00
|
|
|
if (!$status) $status = $this->bo->status['defaults'][$type];
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('status_list',$sb->getArrayItem('status',$status,
|
2001-07-19 03:28:16 +02:00
|
|
|
$this->bo->status[$type]));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$t->set_var('lang_priority',lang('Priority'));
|
|
|
|
if (!isset($pri)) $pri = $this->data['info_pri'];
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('priority_list',$sb->getArrayItem('pri',$pri,
|
|
|
|
$this->enums['priority']));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$t->set_var('lang_confirm',lang('Confirm'));
|
|
|
|
if (!isset($confirm)) $confirm = $this->data['info_confirm'];
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('confirm_list',$sb->getArrayItem('confirm',$confirm,
|
|
|
|
$this->enums['confirm']));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$t->set_var('lang_responsible',lang('Responsible'));
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!isset($responsible)) $responsible=$this->data['info_responsible'];
|
|
|
|
$t->set_var('responsible_list',$sb->getAccount('responsible',
|
|
|
|
$responsible));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$t->set_var('lang_access_type',lang('Private'));
|
|
|
|
if (!isset($access)) $access = $this->data['info_access'] == 'private';
|
|
|
|
$t->set_var('access_list',$html->checkbox('access',$access));
|
|
|
|
|
|
|
|
$t->set_var('edit_button',$html->submit_button('save','Save'));
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$action && $this->bo->check_access($info_id,PHPGW_ACL_DELETE))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('delete_button',$html->form_1button('delete','Delete',
|
2001-07-13 13:10:19 +02:00
|
|
|
array('referer'=>$referer),'/index.php',
|
|
|
|
$this->menuaction('delete')+array('info_id'=>$info_id)));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
$t->set_var('edithandle','');
|
|
|
|
$t->set_var('addhandle','');
|
|
|
|
$t->set_var('subprohandle','');
|
|
|
|
$t->pfp('out','info_edit');
|
|
|
|
$t->pfp('edithandle','edit');
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function delete( )
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $phpgw,$phpgw_info;
|
|
|
|
global $cat_filter,$cat_id,$sort,$order,$query,$start,$filter;
|
|
|
|
global $info_id,$confirm;
|
|
|
|
|
|
|
|
$t = &$this->template; $html = &$this->html;
|
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
$referer = $this->get_referer();
|
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
$hidden_vars = array('sort' => $sort,'order' => $order,
|
|
|
|
'query' => $query,'start' => $start,
|
2001-07-13 13:10:19 +02:00
|
|
|
'filter' => $filter,'cat_id' => $cat_id,
|
|
|
|
'referer' => $referer );
|
2001-07-12 01:17:32 +02:00
|
|
|
if (!$info_id ||
|
|
|
|
!$this->bo->check_access($info_id,PHPGW_ACL_DELETE))
|
|
|
|
{
|
2001-07-13 13:10:19 +02:00
|
|
|
Header('Location: ' . $html->link($referer));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($confirm)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->bo->delete($info_id);
|
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
Header('Location: ' . $html->link($referer,array( 'cd' => 16 )));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$phpgw->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
|
|
|
|
|
|
|
$t->set_file(array( 'info_delete' => 'delete.tpl' ));
|
|
|
|
$t->set_var( $this->setStyleSheet( ));
|
|
|
|
$t->set_var( $this->infoHeaders( ));
|
|
|
|
$t->set_var( $this->formatInfo( $info_id ));
|
2001-07-16 20:11:27 +02:00
|
|
|
$t->set_var('lang_info_action',lang('InfoLog - Delete'));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
$t->set_var('deleteheader',
|
|
|
|
lang('Are you sure you want to delete this entry'));
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('no_button',$html->form_1button('no_button',
|
2001-07-13 13:10:19 +02:00
|
|
|
'No - Cancel','',$referer));
|
2001-07-12 01:17:32 +02:00
|
|
|
$t->set_var('yes_button',$html->form_1button('yes_button',
|
2001-07-13 13:10:19 +02:00
|
|
|
'Yes - Delete',$hidden_vars,'/index.php',
|
2001-07-12 01:17:32 +02:00
|
|
|
array('info_id' => $info_id,'confirm' => 'True')+
|
|
|
|
$this->menuaction('delete')));
|
|
|
|
$t->pfp('out','info_delete');
|
|
|
|
}
|
|
|
|
}
|
2001-07-14 17:49:04 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function preferences( )
|
|
|
|
{
|
2001-07-14 17:49:04 +02:00
|
|
|
global $phpgw,$phpgw_info;
|
|
|
|
global $save;
|
|
|
|
|
|
|
|
$prefs = array(
|
2001-07-14 23:44:01 +02:00
|
|
|
'homeShowEvents' => 'Show open Events: Tasks/Calls/Notes on main screen',
|
2001-07-15 23:42:17 +02:00
|
|
|
'defaultFilter' => 'Default Filter for InfoLog',
|
2001-07-14 23:44:01 +02:00
|
|
|
'listNoSubs' => 'List no Subs/Childs',
|
|
|
|
'longNames' => 'Show full usernames'
|
2001-07-14 17:49:04 +02:00
|
|
|
);
|
2001-07-15 23:42:17 +02:00
|
|
|
$allowed_values = array (
|
|
|
|
'defaultFilter' => $this->filters,
|
|
|
|
);
|
|
|
|
|
2001-07-14 17:49:04 +02:00
|
|
|
$phpgw->preferences->read_repository();
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($save)
|
|
|
|
{
|
|
|
|
while (list($pref,$lang) = each($prefs))
|
|
|
|
{
|
2001-07-14 17:49:04 +02:00
|
|
|
$phpgw->preferences->add('infolog',$pref);
|
|
|
|
}
|
|
|
|
$phpgw->preferences->save_repository(True);
|
|
|
|
|
|
|
|
Header('Location: '.$phpgw->link('/preferences/index.php'));
|
|
|
|
$phpgw->common->phpgw_exit();
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-14 17:49:04 +02:00
|
|
|
$phpgw->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
|
|
|
|
|
|
|
$t = &$this->template; $html = &$this->html;
|
|
|
|
|
|
|
|
$t->set_file(array('info_prefs' => 'preferences.tpl'));
|
|
|
|
|
|
|
|
$vars = Array(
|
|
|
|
'title' => lang('InfoLog preferences'),
|
|
|
|
'text' => ' ',
|
|
|
|
'action_url' => $html->link('/index.php',
|
|
|
|
$this->menuaction('preferences')),
|
|
|
|
'bg_h_color' => $phpgw_info['theme']['th_bg'],
|
|
|
|
'save_button' => $html->submit_button('save','Save'),
|
|
|
|
);
|
|
|
|
$t->set_var($vars);
|
|
|
|
|
|
|
|
$t->set_block('info_prefs', 'pref_line', 'pref_linehandle');
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
while (list($pref,$lang) = each($prefs))
|
|
|
|
{
|
2001-07-14 17:49:04 +02:00
|
|
|
$t->set_var('bg_nm_color',$this->nextmatchs->alternate_row_color());
|
|
|
|
$t->set_var('field',lang($lang));
|
2001-07-15 23:42:17 +02:00
|
|
|
|
|
|
|
if (is_array($allowed_values[$pref]))
|
|
|
|
{
|
|
|
|
if (!is_object($sbox)) $sbox = CreateObject('phpgwapi.sbox2');
|
|
|
|
|
|
|
|
$t->set_var('data',$sbox->getArrayItem($pref,
|
|
|
|
$phpgw_info['user']['preferences']['infolog'][$pref],
|
|
|
|
$allowed_values[$pref],1));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var('data',$html->checkbox($pref,
|
2001-07-14 23:44:01 +02:00
|
|
|
$phpgw_info['user']['preferences']['infolog'][$pref]));
|
2001-07-15 23:42:17 +02:00
|
|
|
}
|
2001-07-14 17:49:04 +02:00
|
|
|
$t->parse('pref_linehandle','pref_line',True);
|
|
|
|
}
|
|
|
|
$t->pfp('out','info_prefs');
|
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|