PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/class.xmodcalendarwd.inc

https://github.com/jcplat/console-seolan
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
  1. <?php
  2. /// Wizard de creation d'un module Agenda
  3. class XModCalendarWd extends XModuleWd {
  4. function __construct($ar=NULL) {
  5. parent::__construct($ar);
  6. XLabels::loadLabels('xmodcalendar');
  7. }
  8. function istep1() {
  9. parent::istep1();
  10. $this->_options->setOpt(XLabels::getSysLabel("general.createstructure"), "createstructure", "boolean");
  11. }
  12. function istep2() {
  13. if($this->_module->createstructure) {
  14. $this->createStructure();
  15. $this->createStructure2();
  16. } else {
  17. $this->_options->setOpt('Agenda : table des agendas', 'tagenda', 'table');
  18. $this->_options->setOpt('Agenda : table des évènements', 'tevt', 'table');
  19. $this->_options->setOpt('Agenda : table des liens', 'tlinks', 'table');
  20. $this->_options->setOpt('Agenda : table des catégories d\'evenements', 'tcatevt', 'table');
  21. $this->_options->setOpt('Agenda : table des catégories d\'agendas', 'tcatagenda', 'table');
  22. $this->_options->setOpt('Planification : table des planifications', 'tplan', 'table');
  23. $this->_options->setOpt('Planification : table des paticipants', 'tplaninv', 'table');
  24. $this->_options->setOpt('Planification : table des dates', 'tplandates', 'table');
  25. }
  26. }
  27. function istep3() {
  28. $this->_options->setOpt('Catégorie "agenda personnel"', 'catperso', 'object', array('table'=>$this->_module->tcatagenda));
  29. $this->_options->setOpt('Vue par défaut', 'defview', 'list',
  30. array('values'=>array('displayDay','displayWeek','displayMonth','displayYear'),
  31. 'labels'=>array('Jour','Semaine','Mois','Année')));
  32. }
  33. function iend($ar=NULL) {
  34. $moid=parent::iend();
  35. $modadm=new XModCalendarAdmWd(array('newmoid'=>XMODCALENDARADM_TOID));
  36. $modadm->_module->modulename='Gestion '.$this->_module->modulename;
  37. $modadm->_module->group=$this->_module->group;
  38. $modadm->_module->calmod=$moid;
  39. $modadm->_module->table=$this->_module->tagenda;
  40. $modadm->_module->order='name,OWN';
  41. $modadm->iend();
  42. }
  43. private function createStructure($ar) {
  44. $module=(array)$this->_module;
  45. $modulename=$module[modulename];
  46. $tables=array();
  47. // TABLE DES CATEGORIES D'AGENDA
  48. //
  49. $tables[4]=XDSTable::newTableNumber('AG');
  50. $newtable=$tables[4];
  51. $ar1=array();
  52. $ar1['translatable']='0';
  53. $ar1['auto_translate']='0';
  54. $ar1['btab']=$newtable;
  55. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Catégories d\'agendas';
  56. XDSTable::procNewSource($ar1);
  57. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  58. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  59. // size ord obl que bro tra mul pub tar
  60. $x->createField('name','Nom','XShortTextDef', '60','2' ,'1','1','1','1','0','1');
  61. $xsetcatag=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  62. $catperso=$xsetcatag->procInput(array('name'=>'Personnel','tplentry'=>TZR_RETURN_DATA));
  63. $xsetcatag->procInput(array('name'=>'Professionnel'));
  64. $xsetcatag->procInput(array('name'=>'Congé'));
  65. $xsetcatag->procInput(array('name'=>'Divers'));
  66. // TABLE DES AGENDAS
  67. //
  68. $tables[0]=XDSTable::newTableNumber('AG');
  69. $newtable=$tables[0];
  70. $ar1['translatable']='0';
  71. $ar1['auto_translate']='0';
  72. $ar1['btab']=$tables[0];
  73. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Agendas';
  74. XDSTable::procNewSource($ar1);
  75. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  76. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  77. // size ord obl que bro tra mul pub tar
  78. $x->createField('name','Nom','XShortTextDef', '100','1' ,'1','1','1','0','0','1');
  79. $x->procEditField(array('field'=>'OWN','table'=>$newtable,'_todo'=>'save','forder'=>2,'target'=>'USERS',
  80. 'published'=>'on','queryable'=>'on','browsable'=>'on','compulsory'=>'on','translatable'=>'off',
  81. 'options'=>array('comment'=>array('FR'=>'Propriétaire de l\'agenda'))));
  82. $x->createField('cat','Catégorie','XLinkDef', '60','3' ,'1','1','1','0','0','0',$tables[4]);
  83. $x->createField('begin','Début','XTimeDef', '5','4' ,'1','1','1','0','0','0');
  84. $x->createField('end','Fin','XTimeDef', '5','5' ,'1','1','1','0','0','0');
  85. $x->createField('def','Agenda par défaut','XBoolDef', '0','6' ,'0','0','0','0','0','0');
  86. $x->createField('defvisi','Visibilitée par défaut','XShortTextDef', '2','7' ,'1','0','0','0','0','0');
  87. $x->createField('mail','Notifier le propriétaire des modifications de l\\\'agenda','XBoolDef','0','8','0','0','0','0','0','0');
  88. $x->createField('cons','Consolidation','XBoolDef', '60','9' ,'0','0','0','0','0','0');
  89. $x->createField('tz','Fuseau horaire','XShortTextDef', '100','10','1','1','0','0','0','0');
  90. $x->createField('agcons','Agenda pour la consolidation','XLinkDef', '100','11','0','0','0','0','1','0',$newtable);
  91. $x->procEditField(array('field'=>'name','table'=>$newtable,'_todo'=>'save',
  92. 'options'=>array('listbox'=>0,'comment'=>array('FR'=>'Nom de l\'agenda à l\'affichage'))));
  93. $x->procEditField(array('field'=>'cat','table'=>$newtable,'_todo'=>'save','target'=>$tables[4],'options'=>array('checkbox'=>0)));
  94. $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save',
  95. 'options'=>array('comment'=>array('FR'=>'Heure de début de l\'affichage par défaut'),
  96. 'display_format'=>'H:M')));
  97. $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save',
  98. 'options'=>array('comment'=>array('FR'=>'Heure de fin de l\'affichage par défaut'),
  99. 'display_format'=>'H:M')));
  100. $x->procEditField(array('field'=>'def','table'=>$newtable,'_todo'=>'save',
  101. 'options'=>array('comment'=>array('FR'=>'Cochez la case pour positionner cet agenda en tant '.
  102. 'qu\'agenda par défaut du propriétaire.'))));
  103. $x->procEditField(array('field'=>'defvisi','table'=>$newtable,'_todo'=>'save',
  104. 'options'=>array('comment'=>array('FR'=>'Visibilitée par défaut des évènements '.
  105. '(PU=Public, OC=Occupé, PR=Privé)'),
  106. 'edit_format'=>'^((PR)||(PU)||(OC))$')));
  107. $x->procEditField(array('field'=>'agcons','table'=>$newtable,'_todo'=>'save','target'=>$newtable,
  108. 'options'=>array('checkbox'=>'0','checkbox_limit'=>'0','autocomplete'=>'0','doublebox'=>1,
  109. 'display_format'=>'%s (%s)',
  110. 'comment'=>array('FR'=>'Si cet agenda est consolidé, liste des agendas à utiliser')
  111. )
  112. )
  113. );
  114. // TABLE DES CATEGORIES D'EVENEMENTS
  115. //
  116. $tables[3]=XDSTable::newTableNumber('AG');
  117. $newtable=$tables[3];
  118. $ar1=array();
  119. $ar1['translatable']='0';
  120. $ar1['auto_translate']='0';
  121. $ar1['btab']=$newtable;
  122. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Catégories d\'évènements';
  123. XDSTable::procNewSource($ar1);
  124. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  125. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  126. // size ord obl que bro tra mul pub tar
  127. $x->createField('name','Nom','XShortTextDef', '60','2' ,'1','1','1','1','0','1');
  128. $x->createField('color','Couleur','XColorDef', '10','3' ,'1','1','1','0','0','0');
  129. $x->createField('recall','Rappel','XRealDef', '5','4' ,'1','0','1','0','0','0');
  130. $x->createField('time','Durée','XRealDef', '5','5' ,'1','0','1','0','0','0');
  131. $x->createField('allday','Journée entière','XBoolDef', '1','6' ,'0','1','1','0','0','0');
  132. $x->createField('commun','Catégorie commune?','XBoolDef', '1','7' ,'0','1','1','0','0','0');
  133. $xsetcatev=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  134. $xsetcatev->procInput(array('name'=>'Rendez-vous',
  135. 'recall'=>0,
  136. 'time'=>60,
  137. 'commun'=>1,
  138. 'allday'=>0));
  139. $xsetcatev->procInput(array('name'=>'Réunion',
  140. 'recall'=>0,
  141. 'time'=>60,
  142. 'commun'=>1,
  143. 'allday'=>0));
  144. $xsetcatev->procInput(array('name'=>'Appel',
  145. 'recall'=>0,
  146. 'time'=>60,
  147. 'commun'=>1,
  148. 'allday'=>0));
  149. $xsetcatev->procInput(array('name'=>'Congé',
  150. 'recall'=>0,
  151. 'time'=>60,
  152. 'commun'=>1,
  153. 'allday'=>1));
  154. $xsetcatev->procInput(array('name'=>'Anniversaire',
  155. 'recall'=>0,
  156. 'time'=>60,
  157. 'commun'=>1,
  158. 'allday'=>0));
  159. // TABLE DES EVENEMENTS
  160. //
  161. $tables[1]=XDSTable::newTableNumber('AG');
  162. $newtable=$tables[1];
  163. $ar1=array();
  164. $ar1['translatable']='0';
  165. $ar1['auto_translate']='0';
  166. $ar1['btab']=$newtable;
  167. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Evènements';
  168. XDSTable::procNewSource($ar1);
  169. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  170. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  171. // size ord obl que bro tra mul pub tar
  172. $x->createField('text','Intitulé','XShortTextDef', '255','2' ,'1','1','1','0','0','1');
  173. $x->createField('begin','Début','XDateTimeDef', '0','3' ,'1','1','1','0','0','0');
  174. $x->createField('end','Fin','XDateTimeDef', '0','4' ,'1','1','1','0','0','0');
  175. $x->createField('allday','Journée entière','XBoolDef', '0','5' ,'0','1','1','0','0','0');
  176. $x->createField('cat','Catégorie','XLinkDef', '0','6' ,'1','1','1','0','0','0',$tables[3]);
  177. $x->createField('place','Lieu','XShortTextDef', '255','7' ,'0','1','1','0','0','0');
  178. $x->createField('descr','Description','XTextDef', '60','8' ,'0','0','0','0','0','0');
  179. $x->createField('visib','Visibilité','XShortTextDef', '10','9' ,'1','1','1','0','0','0');
  180. $x->createField('repet','Répétition','XShortTextDef', '10','10','0','0','0','0','0','0');
  181. $x->createField('end_rep','Fin de la répétition','XDateDef', '0','11','0','0','0','0','0','0');
  182. $x->createField('except','Exception','XTextDef', '60','12','0','0','0','0','0','0');
  183. $x->createField('rrule','Règles de répétition avancées','XTextDef','60','13','0','0','0','0','0','0');
  184. $x->createField('recall','Rappel','XRealDef', '5','14','0','0','0','0','0','0');
  185. $x->createField('isrecal','Rappel effectué','XBoolDef', '0','15','0','0','0','0','0','0');
  186. $x->createField('attext','Invités extérieur','XTextDef', '60','16','0','0','0','0','0','0');
  187. $x->createField('UIDI','UID Import','XShortTextDef', '255','17','0','0','0','0','0','0');
  188. $x->createField('KOIDD','Agenda proprietaire','XLinkDef', '0','18','1','0','0','0','0','0',$tables[0]);
  189. $x->createField('KOIDS','KOID Source','XLinkDef', '0','19','0','0','0','0','0','0',$tables[1]);
  190. $x->procEditField(array('field'=>'text','table'=>$newtable,'_todo'=>'save','options'=>array('listbox'=>'0')));
  191. $x->procEditField(array('field'=>'cat','table'=>$newtable,'_todo'=>'save','target'=>$tables[3],
  192. 'options'=>array('checkbox'=>'0','autocomplete'=>'0')));
  193. $x->procEditField(array('field'=>'place','table'=>$newtable,'todo'=>'save','options'=>array('listbox'=>'0')));
  194. $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
  195. $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
  196. // TABLE DES LIENS AG/EV
  197. //
  198. $tables[2]=XDSTable::newTableNumber('AG');
  199. $newtable=$tables[2];
  200. $ar1=array();
  201. $ar1['translatable']='0';
  202. $ar1['auto_translate']='0';
  203. $ar1['btab']=$newtable;
  204. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Liens';
  205. XDSTable::procNewSource($ar1);
  206. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  207. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  208. // size ord obl que bro tra mul pub tar
  209. $x->createField('KOIDD','Cible','XLinkDef', '0','2' ,'1','1','1','0','0','1');
  210. $x->createField('KOIDE','Evènement','XLinkDef', '0','3' ,'1','1','1','0','0','1',$tables[1]);
  211. $this->_module->tagenda=$tables[0];
  212. $this->_module->tevt=$tables[1];
  213. $this->_module->tlinks=$tables[2];
  214. $this->_module->tcatevt=$tables[3];
  215. $this->_module->tcatagenda=$tables[4];
  216. $this->_module->catperso=$catperso['oid'];
  217. }
  218. // Creation des structures pour planification
  219. public function createStructure2($ar) {
  220. $module=(array)$this->_module;
  221. $modulename=$module[modulename];
  222. $newtable=$tplan=XDSTable::newTableNumber('AG');
  223. $ar1['translatable']='0';
  224. $ar1['auto_translate']='0';
  225. $ar1['btab']=$newtable;
  226. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Planifications';
  227. XDSTable::procNewSource($ar1);
  228. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  229. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  230. // size ord obl que bro tra mul pub tar
  231. $x->createField('ag','Agenda','XLinkDef', '0','2' ,'1','1','1','0','0','0',$module['tagenda']);
  232. $x->createField('title','Titre','XShortTextDef', '255','3' ,'1','1','1','0','0','1');
  233. $x->createField('cat','Catégorie','XLinkDef', '60','4' ,'1','1','1','0','0','0',$module['tcatevt']);
  234. $x->createField('descr','Description','XTextDef', '60','5' ,'0','1','0','0','0','0');
  235. $x->createField('datelim','Date limite de réponse','XDateDef', '0','6' ,'1','1','1','0','0','1');
  236. $x->procEditField(array('field'=>'datelim','table'=>$newtable,'_todo'=>'save','options'=>array('default'=>'+7 days')));
  237. $x->createField('invitt','Texte d\\\'invitation','XRichTextDef', '60','7' ,'1','1','0','0','0','0');
  238. $x->createField('begin','Date de début retenue','XDateTimeDef', '0','8' ,'0','1','0','0','0','0');
  239. $x->createField('end','Date de fin retenue','XDateTimeDef', '0','9' ,'0','1','0','0','0','0');
  240. $x->createField('rem','Remarque','XRichTextDef', '60','10','0','1','0','0','0','0');
  241. $x->createField('cancel','Annulé','XBoolDef', '0','11','0','1','0','0','0','0');
  242. $x->createField('close','Close','XBoolDef', '0','12','0','1','0','0','0','0');
  243. $x->procEditField(array('field'=>'ag','table'=>$newtable,'_todo'=>'save','target'=>$module['tagenda'],
  244. 'options'=>array('readonly'=>1)));
  245. $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
  246. $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
  247. $x->procEditField(array('field'=>'cat','table'=>$newtable,'_todo'=>'save','target'=>$module['tcatevt'],
  248. 'options'=>array('checkbox'=>0,'filter'=>'commun=1')));
  249. $newtable=$tplaninv=XDSTable::newTableNumber('AG');
  250. $ar1['translatable']='0';
  251. $ar1['auto_translate']='0';
  252. $ar1['btab']=$newtable;
  253. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Invités aux planifications';
  254. XDSTable::procNewSource($ar1);
  255. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  256. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  257. // size ord obl que bro tra mul pub tar
  258. $x->createField('planif','Planification','XLinkDef', '0','2' ,'1','1','1','0','0','0',$tplan);
  259. $x->createField('who','Cible','XLinkDef', '0','3' ,'1','1','1','0','0','1',$tplaninv);
  260. $x->createField('part','Participe','XBoolDef', '0','4' ,'0','1','1','0','0','0');
  261. $x->createField('remark','Remarque','XTextDef', '60','5' ,'0','1','1','0','0','0');
  262. $newtable=$tplandates=XDSTable::newTableNumber('AG');
  263. $ar1['translatable']='0';
  264. $ar1['auto_translate']='0';
  265. $ar1['btab']=$newtable;
  266. $ar1['bname'][TZR_DEFAULT_LANG]=$modulename.' - Dates des planifications';
  267. XDSTable::procNewSource($ar1);
  268. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  269. $x->delField(array('field'=>'PUBLISH','action'=>'OK'));
  270. // size ord obl que bro tra mul pub tar
  271. $x->createField('planif','Planification','XLinkDef', '0','2' ,'1','1','1','0','0','0',$tplan);
  272. $x->createField('begin','Date de début','XDateTimeDef', '0','3' ,'1','1','1','0','0','1');
  273. $x->createField('end','Date de fin','XDateTimeDef', '0','4' ,'1','1','1','0','0','1');
  274. $x->createField('confirm','Personnes ayant confirmés','XLinkDef', '0','5' ,'0','1','1','0','1','0');
  275. $x->procEditField(array('field'=>'begin','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
  276. $x->procEditField(array('field'=>'end','table'=>$newtable,'_todo'=>'save','options'=>array('display_format'=>'H:M')));
  277. $this->_module->tplan=$tplan;
  278. $this->_module->tplaninv=$tplaninv;
  279. $this->_module->tplandates=$tplandates;
  280. }
  281. }
  282. ?>