/class.xmodcalendarwd.inc
PHP | 299 lines | 262 code | 17 blank | 20 comment | 2 complexity | 68ff7dfc624bd28dee9fb3d28ea2200b MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, GPL-3.0, Apache-2.0, BSD-3-Clause
- <?php
- /// Wizard de creation d'un module Agenda
- class XModCalendarWd extends XModuleWd {
- function __construct($ar=NULL) {
- parent::__construct($ar);
- XLabels::loadLabels('xmodcalendar');
- }
- function istep1() {
- parent::istep1();
- $this->_options->setOpt(XLabels::getSysLabel("general.createstructure"), "createstructure", "boolean");
- }
- function istep2() {
- if($this->_module->createstructure) {
- $this->createStructure();
- $this->createStructure2();
- } else {
- $this->_options->setOpt('Agenda : table des agendas', 'tagenda', 'table');
- $this->_options->setOpt('Agenda : table des évènements', 'tevt', 'table');
- $this->_options->setOpt('Agenda : table des liens', 'tlinks', 'table');
- $this->_options->setOpt('Agenda : table des catégories d\'evenements', 'tcatevt', 'table');
- $this->_options->setOpt('Agenda : table des catégories d\'agendas', 'tcatagenda', 'table');
- $this->_options->setOpt('Planification : table des planifications', 'tplan', 'table');
- $this->_options->setOpt('Planification : table des paticipants', 'tplaninv', 'table');
- $this->_options->setOpt('Planification : table des dates', 'tplandates', 'table');
- }
- }
- function istep3() {
- $this->_options->setOpt('Catégorie "agenda personnel"', 'catperso', 'object', array('table'=>$this->_module->tcatagenda));
- $this->_options->setOpt('Vue par défaut', 'defview', 'list',
- array('values'=>array('displayDay','displayWeek','displayMonth','displayYear'),
- 'labels'=>array('Jour','Semaine','Mois','Année')));
- }
- function iend($ar=NULL) {
- $moid=parent::iend();
- $modadm=new XModCalendarAdmWd(array('newmoid'=>XMODCALENDARADM_TOID));
- $modadm->_module->modulename='Gestion '.$this->_module->modulename;
- $modadm->_module->group=$this->_module->group;
- $modadm->_module->calmod=$moid;
- $modadm->_module->table=$this->_module->tagenda;
- $modadm->_module->order='name,OWN';
- $modadm->iend();
- }
- private function createStructure($ar) {
- $module=(array)$this->_module;
- $modulename=$module[modulename];
- $tables=array();
- // TABLE DES CATEGORIES D'AGENDA
- //
- $tables[4]=XDSTable::newTableNumber('AG');
- $newtable=$tables[4];
- $ar1=array();
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$newtable;
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Catégories d\'agendas';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('name','Nom','XShortTextDef', '60','2' ,'1','1','1','1','0','1');
- $xsetcatag=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $catperso=$xsetcatag->procInput(array('name'=>'Personnel','tplentry'=>TZR_RETURN_DATA));
- $xsetcatag->procInput(array('name'=>'Professionnel'));
- $xsetcatag->procInput(array('name'=>'Congé'));
- $xsetcatag->procInput(array('name'=>'Divers'));
- // TABLE DES AGENDAS
- //
- $tables[0]=XDSTable::newTableNumber('AG');
- $newtable=$tables[0];
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$tables[0];
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Agendas';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('name','Nom','XShortTextDef', '100','1' ,'1','1','1','0','0','1');
- $x->procEditField(array('field'=>'OWN','table'=>$newtable,'_todo'=>'save','forder'=>2,'target'=>'USERS',
- 'published'=>'on','queryable'=>'on','browsable'=>'on','compulsory'=>'on','translatable'=>'off',
- 'options'=>array('comment'=>array('FR'=>'Propriétaire de l\'agenda'))));
- $x->createField('cat','Catégorie','XLinkDef', '60','3' ,'1','1','1','0','0','0',$tables[4]);
- $x->createField('begin','Début','XTimeDef', '5','4' ,'1','1','1','0','0','0');
- $x->createField('end','Fin','XTimeDef', '5','5' ,'1','1','1','0','0','0');
- $x->createField('def','Agenda par défaut','XBoolDef', '0','6' ,'0','0','0','0','0','0');
- $x->createField('defvisi','Visibilitée par défaut','XShortTextDef', '2','7' ,'1','0','0','0','0','0');
- $x->createField('mail','Notifier le propriétaire des modifications de l\\\'agenda','XBoolDef','0','8','0','0','0','0','0','0');
- $x->createField('cons','Consolidation','XBoolDef', '60','9' ,'0','0','0','0','0','0');
- $x->createField('tz','Fuseau horaire','XShortTextDef', '100','10','1','1','0','0','0','0');
- $x->createField('agcons','Agenda pour la consolidation','XLinkDef', '100','11','0','0','0','0','1','0',$newtable);
- $x->procEditField(array('field'=>'name','table'=>$newtable,'_todo'=>'save',
- 'options'=>array('listbox'=>0,'comment'=>array('FR'=>'Nom de l\'agenda à l\'affichage'))));
- $x->procEditField(array('field'=>'cat','table'=>$newtable,'_todo'=>'save','target'=>$tables[4],'options'=>array('checkbox'=>0)));
- $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save',
- 'options'=>array('comment'=>array('FR'=>'Heure de début de l\'affichage par défaut'),
- 'display_format'=>'H:M')));
- $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save',
- 'options'=>array('comment'=>array('FR'=>'Heure de fin de l\'affichage par défaut'),
- 'display_format'=>'H:M')));
- $x->procEditField(array('field'=>'def','table'=>$newtable,'_todo'=>'save',
- 'options'=>array('comment'=>array('FR'=>'Cochez la case pour positionner cet agenda en tant '.
- 'qu\'agenda par défaut du propriétaire.'))));
- $x->procEditField(array('field'=>'defvisi','table'=>$newtable,'_todo'=>'save',
- 'options'=>array('comment'=>array('FR'=>'Visibilitée par défaut des évènements '.
- '(PU=Public, OC=Occupé, PR=Privé)'),
- 'edit_format'=>'^((PR)||(PU)||(OC))$')));
- $x->procEditField(array('field'=>'agcons','table'=>$newtable,'_todo'=>'save','target'=>$newtable,
- 'options'=>array('checkbox'=>'0','checkbox_limit'=>'0','autocomplete'=>'0','doublebox'=>1,
- 'display_format'=>'%s (%s)',
- 'comment'=>array('FR'=>'Si cet agenda est consolidé, liste des agendas à utiliser')
- )
- )
- );
-
- // TABLE DES CATEGORIES D'EVENEMENTS
- //
- $tables[3]=XDSTable::newTableNumber('AG');
- $newtable=$tables[3];
- $ar1=array();
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$newtable;
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Catégories d\'évènements';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('name','Nom','XShortTextDef', '60','2' ,'1','1','1','1','0','1');
- $x->createField('color','Couleur','XColorDef', '10','3' ,'1','1','1','0','0','0');
- $x->createField('recall','Rappel','XRealDef', '5','4' ,'1','0','1','0','0','0');
- $x->createField('time','Durée','XRealDef', '5','5' ,'1','0','1','0','0','0');
- $x->createField('allday','Journée entière','XBoolDef', '1','6' ,'0','1','1','0','0','0');
- $x->createField('commun','Catégorie commune?','XBoolDef', '1','7' ,'0','1','1','0','0','0');
- $xsetcatev=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $xsetcatev->procInput(array('name'=>'Rendez-vous',
- 'recall'=>0,
- 'time'=>60,
- 'commun'=>1,
- 'allday'=>0));
- $xsetcatev->procInput(array('name'=>'Réunion',
- 'recall'=>0,
- 'time'=>60,
- 'commun'=>1,
- 'allday'=>0));
- $xsetcatev->procInput(array('name'=>'Appel',
- 'recall'=>0,
- 'time'=>60,
- 'commun'=>1,
- 'allday'=>0));
- $xsetcatev->procInput(array('name'=>'Congé',
- 'recall'=>0,
- 'time'=>60,
- 'commun'=>1,
- 'allday'=>1));
- $xsetcatev->procInput(array('name'=>'Anniversaire',
- 'recall'=>0,
- 'time'=>60,
- 'commun'=>1,
- 'allday'=>0));
- // TABLE DES EVENEMENTS
- //
- $tables[1]=XDSTable::newTableNumber('AG');
- $newtable=$tables[1];
- $ar1=array();
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$newtable;
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Evènements';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('text','Intitulé','XShortTextDef', '255','2' ,'1','1','1','0','0','1');
- $x->createField('begin','Début','XDateTimeDef', '0','3' ,'1','1','1','0','0','0');
- $x->createField('end','Fin','XDateTimeDef', '0','4' ,'1','1','1','0','0','0');
- $x->createField('allday','Journée entière','XBoolDef', '0','5' ,'0','1','1','0','0','0');
- $x->createField('cat','Catégorie','XLinkDef', '0','6' ,'1','1','1','0','0','0',$tables[3]);
- $x->createField('place','Lieu','XShortTextDef', '255','7' ,'0','1','1','0','0','0');
- $x->createField('descr','Description','XTextDef', '60','8' ,'0','0','0','0','0','0');
- $x->createField('visib','Visibilité','XShortTextDef', '10','9' ,'1','1','1','0','0','0');
- $x->createField('repet','Répétition','XShortTextDef', '10','10','0','0','0','0','0','0');
- $x->createField('end_rep','Fin de la répétition','XDateDef', '0','11','0','0','0','0','0','0');
- $x->createField('except','Exception','XTextDef', '60','12','0','0','0','0','0','0');
- $x->createField('rrule','Règles de répétition avancées','XTextDef','60','13','0','0','0','0','0','0');
- $x->createField('recall','Rappel','XRealDef', '5','14','0','0','0','0','0','0');
- $x->createField('isrecal','Rappel effectué','XBoolDef', '0','15','0','0','0','0','0','0');
- $x->createField('attext','Invités extérieur','XTextDef', '60','16','0','0','0','0','0','0');
- $x->createField('UIDI','UID Import','XShortTextDef', '255','17','0','0','0','0','0','0');
- $x->createField('KOIDD','Agenda proprietaire','XLinkDef', '0','18','1','0','0','0','0','0',$tables[0]);
- $x->createField('KOIDS','KOID Source','XLinkDef', '0','19','0','0','0','0','0','0',$tables[1]);
- $x->procEditField(array('field'=>'text','table'=>$newtable,'_todo'=>'save','options'=>array('listbox'=>'0')));
- $x->procEditField(array('field'=>'cat','table'=>$newtable,'_todo'=>'save','target'=>$tables[3],
- 'options'=>array('checkbox'=>'0','autocomplete'=>'0')));
- $x->procEditField(array('field'=>'place','table'=>$newtable,'todo'=>'save','options'=>array('listbox'=>'0')));
- $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
- $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
- // TABLE DES LIENS AG/EV
- //
- $tables[2]=XDSTable::newTableNumber('AG');
- $newtable=$tables[2];
- $ar1=array();
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$newtable;
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Liens';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('KOIDD','Cible','XLinkDef', '0','2' ,'1','1','1','0','0','1');
- $x->createField('KOIDE','Evènement','XLinkDef', '0','3' ,'1','1','1','0','0','1',$tables[1]);
- $this->_module->tagenda=$tables[0];
- $this->_module->tevt=$tables[1];
- $this->_module->tlinks=$tables[2];
- $this->_module->tcatevt=$tables[3];
- $this->_module->tcatagenda=$tables[4];
- $this->_module->catperso=$catperso['oid'];
- }
- // Creation des structures pour planification
- public function createStructure2($ar) {
- $module=(array)$this->_module;
- $modulename=$module[modulename];
-
- $newtable=$tplan=XDSTable::newTableNumber('AG');
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$newtable;
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Planifications';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('ag','Agenda','XLinkDef', '0','2' ,'1','1','1','0','0','0',$module['tagenda']);
- $x->createField('title','Titre','XShortTextDef', '255','3' ,'1','1','1','0','0','1');
- $x->createField('cat','Catégorie','XLinkDef', '60','4' ,'1','1','1','0','0','0',$module['tcatevt']);
- $x->createField('descr','Description','XTextDef', '60','5' ,'0','1','0','0','0','0');
- $x->createField('datelim','Date limite de réponse','XDateDef', '0','6' ,'1','1','1','0','0','1');
- $x->procEditField(array('field'=>'datelim','table'=>$newtable,'_todo'=>'save','options'=>array('default'=>'+7 days')));
- $x->createField('invitt','Texte d\\\'invitation','XRichTextDef', '60','7' ,'1','1','0','0','0','0');
- $x->createField('begin','Date de début retenue','XDateTimeDef', '0','8' ,'0','1','0','0','0','0');
- $x->createField('end','Date de fin retenue','XDateTimeDef', '0','9' ,'0','1','0','0','0','0');
- $x->createField('rem','Remarque','XRichTextDef', '60','10','0','1','0','0','0','0');
- $x->createField('cancel','Annulé','XBoolDef', '0','11','0','1','0','0','0','0');
- $x->createField('close','Close','XBoolDef', '0','12','0','1','0','0','0','0');
- $x->procEditField(array('field'=>'ag','table'=>$newtable,'_todo'=>'save','target'=>$module['tagenda'],
- 'options'=>array('readonly'=>1)));
- $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
- $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
- $x->procEditField(array('field'=>'cat','table'=>$newtable,'_todo'=>'save','target'=>$module['tcatevt'],
- 'options'=>array('checkbox'=>0,'filter'=>'commun=1')));
-
- $newtable=$tplaninv=XDSTable::newTableNumber('AG');
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$newtable;
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Invités aux planifications';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('planif','Planification','XLinkDef', '0','2' ,'1','1','1','0','0','0',$tplan);
- $x->createField('who','Cible','XLinkDef', '0','3' ,'1','1','1','0','0','1',$tplaninv);
- $x->createField('part','Participe','XBoolDef', '0','4' ,'0','1','1','0','0','0');
- $x->createField('remark','Remarque','XTextDef', '60','5' ,'0','1','1','0','0','0');
- $newtable=$tplandates=XDSTable::newTableNumber('AG');
- $ar1['translatable']='0';
- $ar1['auto_translate']='0';
- $ar1['btab']=$newtable;
- $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Dates des planifications';
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
- // size ord obl que bro tra mul pub tar
- $x->createField('planif','Planification','XLinkDef', '0','2' ,'1','1','1','0','0','0',$tplan);
- $x->createField('begin','Date de début','XDateTimeDef', '0','3' ,'1','1','1','0','0','1');
- $x->createField('end','Date de fin','XDateTimeDef', '0','4' ,'1','1','1','0','0','1');
- $x->createField('confirm','Personnes ayant confirmés','XLinkDef', '0','5' ,'0','1','1','0','1','0');
- $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
- $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
- $this->_module->tplan=$tplan;
- $this->_module->tplaninv=$tplaninv;
- $this->_module->tplandates=$tplandates;
- }
- }
- ?>