[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare - ProjectManager - Milestones user interface * 4 * http://www.egroupware.org * 5 * Written and (c) 2005 by Ralf Becker <RalfBecker@outdoor-training.de> * 6 * -------------------------------------------- * 7 * This program is free software; you can redistribute it and/or modify it * 8 * under the terms of the GNU General Public License as published by the * 9 * Free Software Foundation; either version 2 of the License, or (at your * 10 * option) any later version. * 11 \**************************************************************************/ 12 13 /* $Id: class.uimilestones.inc.php 18273 2005-05-10 14:51:35Z ralfbecker $ */ 14 15 include_once (EGW_INCLUDE_ROOT.'/projectmanager/inc/class.boprojectmanager.inc.php'); 16 17 /** 18 * Milestones user interface of the projectmanager 19 * 20 * @package projectmanager 21 * @author RalfBecker-AT-outdoor-training.de 22 * @copyright (c) 2005 by RalfBecker-AT-outdoor-training.de 23 * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License 24 */ 25 class uimilestones extends boprojectmanager 26 { 27 /** 28 * @var array $public_functions Functions to call via menuaction 29 */ 30 var $public_functions = array( 31 'edit' => true, 32 'view' => true, 33 ); 34 var $tpl; 35 36 /** 37 * Constructor, calls the constructor of the extended class 38 */ 39 function uimilestones() 40 { 41 $this->tpl =& CreateObject('etemplate.etemplate'); 42 43 if ((int) $_REQUEST['pm_id']) 44 { 45 $pm_id = (int) $_REQUEST['pm_id']; 46 } 47 else 48 { 49 $pm_id = $GLOBALS['egw']->session->appsession('pm_id','projectmanager'); 50 } 51 if (!$pm_id) 52 { 53 $this->tpl->location(array( 54 'menuaction' => 'projectmanager.uiprojectmanager.index', 55 'msg' => lang('You need to select a project first'), 56 )); 57 } 58 $this->boprojectmanager($pm_id); 59 60 // check if we have at least read-access to this project 61 if (!$this->check_acl(EGW_ACL_READ)) 62 { 63 $this->tpl->location(array( 64 'menuaction' => 'projectmanager.uiprojectmanager.index', 65 'msg' => lang('Permission denied !!!'), 66 )); 67 } 68 if (!is_object($this->milestones)) 69 { 70 $this->milestones =& CreateObject('projectmanager.somilestones'); 71 } 72 } 73 74 /** 75 * View a milestone, only calls edit(null,true); 76 */ 77 function view() 78 { 79 $this->edit(null,true); 80 } 81 82 /** 83 * Edit a milestone 84 * 85 * @param array $content=null posted content 86 * @param boolean $view=false only view the milestone? 87 */ 88 function edit($content=null,$view=false) 89 { 90 $view = $view || $content['view'] || !$this->check_acl(EGW_ACL_EDIT); 91 92 if (is_array($content)) 93 { 94 if ($content['pm_id'] != $this->data['pm_id']) 95 { 96 $this->read($content['pm_id']); 97 } 98 $this->milestones->data_merge($content); 99 100 if ($this->check_acl(EGW_ACL_EDIT)) 101 { 102 if ($content['save'] || $content['apply']) 103 { 104 if ($this->milestones->save() != 0) 105 { 106 $msg = lang('Error: saving milestone'); 107 unset($content['save']); 108 } 109 else 110 { 111 $msg = lang('Milestone saved'); 112 $js = "opener.location.href='".$GLOBALS['phpgw']->link('/index.php',array( 113 'menuaction' => 'projectmanager.ganttchart.show', 114 'msg' => $msg, 115 ))."';"; 116 } 117 } 118 if ($content['delete'] && $content['ms_id']) 119 { 120 if ($this->milestones->delete(array( 121 'pm_id' => $content['pm_id'], 122 'ms_id' => $content['ms_id'], 123 ))) 124 { 125 $msg = lang('Milestone deleted'); 126 $js = "opener.location.href='".$GLOBALS['phpgw']->link('/index.php',array( 127 'menuaction' => 'projectmanager.ganttchart.show', 128 'msg' => $msg, 129 ))."';"; 130 } 131 } 132 if ($content['edit'] && $this->check_acl(EGW_ACL_EDIT)) 133 { 134 $view = false; 135 } 136 } 137 if ($content['save'] || $content['cancel'] || $content['delete']) 138 { 139 $js .= 'window.close();'; 140 echo '<html><body onload="'.$js.'"></body></html>'; 141 $GLOBALS['egw']->common->egw_exit(); 142 } 143 } 144 elseif ($_REQUEST['ms_id']) 145 { 146 $this->milestones->read(array( 147 'ms_id' => $_REQUEST['ms_id'], 148 )); 149 } 150 else 151 { 152 $this->milestones->data['pm_id'] = $this->data['pm_id']; 153 } 154 $content = $this->milestones->data + array( 155 'msg' => $msg, 156 'js' => '<script>'.$js.'</script>', 157 ); 158 159 if ($view) 160 { 161 $readonlys = array( 162 'edit' => !$this->check_acl(EGW_ACL_EDIT), 163 'save' => true, 164 'apply' => true, 165 'delete' => true, 166 'pm_id' => true, 167 'ms_title' => true, 168 'ms_date' => true, 169 'ms_description' => true, 170 ); 171 $sel_options = array( 172 'pm_id' => array($this->data['pm_id'] => $this->data['pm_title']), 173 ); 174 } 175 else 176 { 177 $readonlys = array( 178 'edit' => true, 179 ); 180 $sel_options = array( 181 'pm_id' => $this->query_list('pm_title','pm_id'), 182 ); 183 } 184 $readonlys['delete'] = !$this->milestones->data['ms_id'] || !$this->check_acl(EGW_ACL_EDIT); 185 186 $GLOBALS['egw_info']['flags']['app_header'] = lang('projectmanager').' - '.($view ? lang('View milestone') : 187 ($this->milestones->data['ms_id'] ? lang('Edit milestone') : lang('Add milestone'))); 188 $this->tpl->read('projectmanager.milestone.edit'); 189 $this->tpl->exec('projectmanager.uimilestones.edit',$content,$sel_options,$readonlys,$this->milestones->data+array( 190 'view' => $view, 191 ),2); 192 } 193 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |