Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
afi
opacce
Commits
3f8811e0
Commit
3f8811e0
authored
Mar 07, 2019
by
Patrick Barroca
😁
Browse files
dev #77660 : rendez-vous management
parent
8f3d730d
Pipeline
#6695
passed with stage
in 36 minutes and 8 seconds
Changes
88
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
420 additions
and
1 deletion
+420
-1
VERSIONS_WIP/77660
VERSIONS_WIP/77660
+1
-0
application/modules/admin/controllers/RendezVousController.php
...cation/modules/admin/controllers/RendezVousController.php
+40
-0
application/modules/admin/controllers/UsergroupAgendaController.php
...n/modules/admin/controllers/UsergroupAgendaController.php
+28
-0
application/modules/admin/views/scripts/rendez-vous/add.phtml
...ication/modules/admin/views/scripts/rendez-vous/add.phtml
+2
-0
application/modules/admin/views/scripts/rendez-vous/duplicate.phtml
...n/modules/admin/views/scripts/rendez-vous/duplicate.phtml
+2
-0
application/modules/admin/views/scripts/rendez-vous/edit.phtml
...cation/modules/admin/views/scripts/rendez-vous/edit.phtml
+2
-0
application/modules/admin/views/scripts/rendez-vous/index.phtml
...ation/modules/admin/views/scripts/rendez-vous/index.phtml
+16
-0
application/modules/admin/views/scripts/usergroup-agenda/add.phtml
...on/modules/admin/views/scripts/usergroup-agenda/add.phtml
+1
-0
application/modules/admin/views/scripts/usergroup-agenda/all.phtml
...on/modules/admin/views/scripts/usergroup-agenda/all.phtml
+2
-0
application/modules/admin/views/scripts/usergroup-agenda/edit.phtml
...n/modules/admin/views/scripts/usergroup-agenda/edit.phtml
+1
-0
application/modules/admin/views/scripts/usergroup-agenda/index.phtml
.../modules/admin/views/scripts/usergroup-agenda/index.phtml
+18
-0
application/modules/admin/views/scripts/usergroup-agenda/user-select.phtml
...es/admin/views/scripts/usergroup-agenda/user-select.phtml
+16
-0
application/modules/opac/controllers/AbonneController.php
application/modules/opac/controllers/AbonneController.php
+9
-0
application/modules/opac/views/scripts/abonne/fiche.phtml
application/modules/opac/views/scripts/abonne/fiche.phtml
+1
-0
application/modules/opac/views/scripts/abonne/rendez-vous.phtml
...ation/modules/opac/views/scripts/abonne/rendez-vous.phtml
+6
-0
cosmogramme/sql/patch/patch_369.php
cosmogramme/sql/patch/patch_369.php
+20
-0
library/Class/AdminVar.php
library/Class/AdminVar.php
+12
-1
library/Class/RendezVous.php
library/Class/RendezVous.php
+157
-0
library/Class/RendezVous/SearchCriteria.php
library/Class/RendezVous/SearchCriteria.php
+35
-0
library/Class/RendezVous/SearchCriteria/Comment.php
library/Class/RendezVous/SearchCriteria/Comment.php
+51
-0
No files found.
VERSIONS_WIP/77660
0 → 100644
View file @
3f8811e0
- ticket #77660 : Administration : ajout d'un module de gestion des rendez-vous
\ No newline at end of file
application/modules/admin/controllers/RendezVousController.php
0 → 100644
View file @
3f8811e0
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Admin_RendezVousController
extends
ZendAfi_Controller_Action
{
public
function
getPlugins
()
{
return
[
'ZendAfi_Controller_Plugin_ResourceDefinition_RendezVous'
,
'ZendAfi_Controller_Plugin_Manager_RendezVous'
];
}
public
function
indexAction
()
{
if
(
!
Class_UserGroup
::
find
(
$this
->
_request
->
getParam
(
'group_id'
,
0
)))
{
$this
->
_helper
->
notify
(
$this
->
_
(
'Liste des rendez-vous impossible : Agenda inconnu'
));
return
$this
->
_redirect
(
$this
->
view
->
url
([
'module'
=>
'admin'
,
'controller'
=>
'usergroup-agenda'
,
'action'
=>
'index'
],
null
,
true
));
}
parent
::
indexAction
();
}
}
application/modules/admin/controllers/UsergroupAgendaController.php
0 → 100644
View file @
3f8811e0
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Admin_UsergroupAgendaController
extends
ZendAfi_Controller_Action
{
public
function
getPlugins
()
{
return
[
'ZendAfi_Controller_Plugin_ResourceDefinition_UsergroupAgenda'
,
'ZendAfi_Controller_Plugin_Manager_UsergroupAgenda'
];
}
}
application/modules/admin/views/scripts/rendez-vous/add.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
renderForm
(
$this
->
form
);
application/modules/admin/views/scripts/rendez-vous/duplicate.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
renderForm
(
$this
->
form
);
application/modules/admin/views/scripts/rendez-vous/edit.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
renderForm
(
$this
->
form
);
application/modules/admin/views/scripts/rendez-vous/index.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
button_New
((
new
Class_Entity
())
->
setText
(
$this
->
_
(
'Ajouter un rendez-vous'
)));
echo
$this
->
button_Back
((
new
Class_Entity
())
->
setText
(
$this
->
_
(
'Retour aux agendas'
))
->
setUrl
(
$this
->
url
([
'module'
=>
'admin'
,
'controller'
=>
'usergroup-agenda'
],
null
,
true
)));
$description
=
(
new
Class_TableDescription
(
'rendez-vous'
))
->
addColumn
(
$this
->
_
(
'Date'
),
'date'
)
->
addColumn
(
$this
->
_
(
'Heure de début'
),
'formatted_begin_time'
)
->
addColumn
(
$this
->
_
(
'Heure de fin'
),
'formatted_end_time'
)
->
addColumn
(
$this
->
_
(
'Lieu'
),
'location_label'
)
->
addRowAction
(
function
(
$model
)
{
return
$this
->
renderPluginsActions
(
$model
);
});
echo
$this
->
renderTable
(
$description
,
$this
->
rendezvous
);
application/modules/admin/views/scripts/usergroup-agenda/add.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
renderForm
(
$this
->
form
);
application/modules/admin/views/scripts/usergroup-agenda/all.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
searchRendezVous
(
$this
->
search
,
$this
->
rendezvous
);
application/modules/admin/views/scripts/usergroup-agenda/edit.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
renderForm
(
$this
->
form
);
application/modules/admin/views/scripts/usergroup-agenda/index.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
button_New
((
new
Class_Entity
())
->
setText
(
$this
->
_
(
'Créer un agenda'
)));
echo
$this
->
button
((
new
Class_Entity
())
->
setText
(
$this
->
_
(
'Tous les rendez-vous'
))
->
setUrl
(
$this
->
url
([
'module'
=>
'admin'
,
'controller'
=>
'usergroup-agenda'
,
'action'
=>
'all'
],
null
,
true
))
->
setImage
(
$this
->
tagImg
(
Class_Admin_Skin
::
current
()
->
getIconUrl
(
'buttons'
,
'test'
))));
$description
=
(
new
Class_TableDescription
(
'agendas'
))
->
addColumn
(
$this
->
_
(
'Libellé'
),
'libelle'
)
->
addRowAction
(
function
(
$model
)
{
return
$this
->
renderPluginsActions
(
$model
);
});
echo
$this
->
renderTable
(
$description
,
$this
->
groups
);
application/modules/admin/views/scripts/usergroup-agenda/user-select.phtml
0 → 100644
View file @
3f8811e0
<?php
$actions
=
function
(
$model
)
{
return
$this
->
renderModelActions
(
$model
,
[[
'url'
=>
'#'
,
'icon'
=>
'add_user'
,
'label'
=>
$this
->
_
(
'Ajouter "%s" comme destinataire'
,
$model
->
getNomComplet
()),
'anchorOptions'
=>
[
'class'
=>
'user_add_action'
,
'data-userid'
=>
$model
->
getId
(),
'data-username'
=>
$model
->
getNomComplet
()]]
]);
};
echo
$this
->
tag
(
'div'
,
$this
->
Admin_SearchUsers
(
$this
->
users
,
$this
->
total
,
$this
->
form
,
$this
->
page
,
$this
->
params
,
$actions
),
[
'class'
=>
'modules'
]);
application/modules/opac/controllers/AbonneController.php
View file @
3f8811e0
...
...
@@ -1359,4 +1359,13 @@ class AbonneController extends ZendAfi_Controller_Action {
return
$this
->
_redirectToReferer
();
}
public
function
rendezVousAction
()
{
if
(
!
Class_AdminVar
::
isRendezVousEnabled
())
return
$this
->
_redirect
(
'/abonne/fiche'
);
$this
->
view
->
titre
=
$this
->
_
(
'Mes Rendez-vous'
);
$this
->
view
->
user_rendez_vous
=
new
Class_User_RendezVous
(
$this
->
_user
);
}
}
\ No newline at end of file
application/modules/opac/views/scripts/abonne/fiche.phtml
View file @
3f8811e0
...
...
@@ -13,6 +13,7 @@ echo $this->abonne_Multimedia($this->user);
echo
$this
->
abonne_SuggestionAchat
(
$this
->
user
);
echo
$this
->
abonne_Settings
(
$this
->
user
);
echo
$this
->
abonne_Cards
(
$this
->
user
);
echo
$this
->
abonne_RendezVous
(
$this
->
user
);
echo
$this
->
abonne_Deconnexion
(
$this
->
user
);
if
(
$this
->
error
)
...
...
application/modules/opac/views/scripts/abonne/rendez-vous.phtml
0 → 100644
View file @
3f8811e0
<?php
echo
$this
->
openBoiteContent
(
$this
->
titre
)
.
$this
->
abonne_RendezVousIndex
(
$this
->
user_rendez_vous
)
.
$this
->
closeBoiteContent
()
.
$this
->
abonne_RetourFiche
()
;
\ No newline at end of file
cosmogramme/sql/patch/patch_369.php
0 → 100644
View file @
3f8811e0
<?php
$adapter
=
Zend_Db_Table_Abstract
::
getDefaultAdapter
();
try
{
$adapter
->
query
(
'create table `rendez_vous` ('
.
'`id` int(11) unsigned not null auto_increment,'
.
'`group_id` int(11) not null,'
.
'`location_id` int(11) null default null,'
.
'`date` date not null,'
.
'`begin_time` varchar(255) not null,'
.
'`end_time` varchar(255) not null,'
.
'`comment` varchar(255),'
.
'primary key (id),'
.
'key `group_id` (`group_id`),'
.
'key `location_id` (`location_id`),'
.
'key `date` (`date`),'
.
'key `comment` (`comment`)'
.
') engine=MyISAM default charset=utf8'
);
}
catch
(
Exception
$e
)
{}
library/Class/AdminVar.php
View file @
3f8811e0
...
...
@@ -134,7 +134,8 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
'lesocial'
=>
$this
->
_getLeSocialVars
(),
'static_map'
=>
$this
->
_getStaticMapVars
(),
'search'
=>
$this
->
_getSearchVars
(),
'file-manager'
=>
$this
->
_getFileManagerVars
()
'file-manager'
=>
$this
->
_getFileManagerVars
(),
'usergroup-agenda'
=>
$this
->
_getRendezVousVars
(),
];
}
...
...
@@ -467,6 +468,11 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
}
protected
function
_getRendezVousVars
()
{
return
[
'ENABLE_RENDEZ_VOUS'
=>
Class_AdminVar_Meta
::
newOnOff
(
$this
->
_
(
'Activer la gestion des rendez-vous'
))];
}
public
function
allVarsValues
()
{
if
(
null
!==
$this
->
_all_vars_values
)
return
$this
->
_all_vars_values
;
...
...
@@ -1012,6 +1018,11 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
public
function
shouldKeepLastSigbRecord
()
{
return
Class_AdminVar
::
isModuleEnabled
(
'KEEP_LAST_SIGB_RECORD'
);
}
public
function
isRendezVousEnabled
()
{
return
Class_AdminVar
::
isModuleEnabled
(
'ENABLE_RENDEZ_VOUS'
);
}
}
...
...
library/Class/RendezVous.php
0 → 100644
View file @
3f8811e0
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
RendezVousLoader
extends
Storm_Model_Loader
{
use
Trait_TimeSource
;
public
function
findAllFutureByGroup
(
$group
)
{
return
$group
?
Class_RendezVous
::
findAllBy
([
'group_id'
=>
(
int
)
$group
->
getId
(),
'where'
=>
'date >= "'
.
$this
->
getTimeSource
()
->
dateYmd
()
.
'"'
])
:
[];
}
}
class
Class_RendezVous
extends
Storm_Model_Abstract
{
use
Trait_Translator
,
Trait_TimeSource
;
protected
$_table_name
=
'rendez_vous'
;
protected
$_loader_class
=
'RendezVousLoader'
;
protected
$_belongs_to
=
[
'agenda'
=>
[
'model'
=>
'Class_UserGroup'
,
'referenced_in'
=>
'group_id'
],
'location'
=>
[
'model'
=>
'Class_Lieu'
,
'referenced_in'
=>
'location_id'
]];
protected
$_default_attribute_values
=
[
'group_id'
=>
null
,
'location_id'
=>
null
,
'date'
=>
null
,
'begin_time'
=>
null
,
'end_time'
=>
null
,
'comment'
=>
''
];
public
function
getLibelle
()
{
return
$this
->
_
(
'Le %s de %s à %s'
,
$this
->
getFormattedDate
(),
$this
->
getFormattedBeginTime
(),
$this
->
getFormattedEndTime
());
}
public
function
getFormattedDate
()
{
return
strftime
(
'%A %d %B'
,
strtotime
(
$this
->
getDate
()));
}
public
function
getFormattedBeginTime
()
{
return
$this
->
getFormattedTime
(
$this
->
getBeginTime
());
}
public
function
getFormattedEndTime
()
{
return
$this
->
getFormattedTime
(
$this
->
getEndTime
());
}
public
function
getFormattedTime
(
$value
)
{
return
str_replace
(
':'
,
'h'
,
$value
);
}
public
function
getLocationLabel
()
{
return
$this
->
hasLocation
()
?
$this
->
getLocation
()
->
getLibelle
()
:
''
;
}
public
function
getAgendaLabel
()
{
return
$this
->
hasAgenda
()
?
$this
->
getAgenda
()
->
getLibelle
()
:
''
;
}
public
function
validate
()
{
$this
->
check
(
$this
->
hasAgenda
(),
$this
->
_
(
'L\'agenda est obligatoire'
));
$this
->
checkAttribute
(
'date'
,
$this
->
hasDate
()
&&
(
new
ZendAfi_Validate_DateFormat
())
->
isValid
(
$this
->
getDate
()),
$this
->
_
(
'La date doit être au forma JJ/MM/AAAA'
));
$this
->
_validateTime
(
'begin_time'
,
$this
->
_
(
'L\'heure de début est obligatoire'
));
$this
->
_validateTime
(
'end_time'
,
$this
->
_
(
'L\'heure de fin est obligatoire'
));
$this
->
checkAttribute
(
'end_time'
,
$this
->
getBeginTime
()
<
$this
->
getEndTime
(),
$this
->
_
(
'L\'heure de fin doit être après l\'heure de début'
));
}
protected
function
_validateTime
(
$field
,
$message
)
{
$this
->
checkAttribute
(
'begin_time'
,
$this
->
_has
(
$field
),
$message
);
$this
->
checkAttribute
(
$field
,
$this
->
getTimeSource
()
->
isValidHourMinutes
(
$this
->
_get
(
$field
)),
$this
->
_
(
'L\'heure doit être au format HH:mm'
));
}
public
function
setDate
(
$value
)
{
$this
->
_set
(
'date'
,
$this
->
_ensureDateFormat
(
$value
));
}
protected
function
_ensureDateFormat
(
$value
)
{
if
(
!
$value
)
return
null
;
if
(
false
===
strpos
(
$value
,
'/'
))
return
$value
;
return
implode
(
'-'
,
array_reverse
(
explode
(
'/'
,
$value
)));
}
public
function
copy
()
{
$attributes
=
$this
->
_attributes
;
unset
(
$attributes
[
'id'
]);
return
(
new
static
())
->
updateAttributes
(
$attributes
);
}
/**
* @param $other Class_RendezVous
* @return int -1 less, 0 equal, 1 greater
*/
public
function
compare
(
$other
)
{
if
(
!
$other
)
return
0
;
if
(
0
!==
$date_comp
=
strnatcmp
(
$this
->
getDate
(),
$other
->
getDate
()))
return
$date_comp
;
if
(
0
!==
$begin_comp
=
strnatcmp
(
$this
->
getBeginTime
(),
$other
->
getBeginTime
()))
return
$begin_comp
;
return
strnatcmp
(
$this
->
getEndTime
(),
$other
->
getEndTime
());
}
}
\ No newline at end of file
library/Class/RendezVous/SearchCriteria.php
0 → 100644
View file @
3f8811e0
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_RendezVous_SearchCriteria
extends
Class_SearchCriteria
{
protected
$_model_class
=
'Class_RendezVous'
;
public
function
__construct
(
$params
)
{
$this
->
_criteria
=
[
new
Class_RendezVous_SearchCriteria_User
(
$params
),
new
Class_RendezVous_SearchCriteria_Comment
(
$params
),
new
Class_RendezVous_SearchCriteria_Date
(
$params
),
new
Class_RendezVous_SearchCriteria_Location
(
$params
),
new
Class_RendezVous_SearchCriteria_Order
(
$params
),
];
}
}
library/Class/RendezVous/SearchCriteria/Comment.php
0 → 100644
View file @
3f8811e0
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_RendezVous_SearchCriteria_Comment
extends
Class_SearchCriteria_Abstract
{
protected
$_name
=
'comment'
,
$_value
=
''
;
public
function
__construct
(
$params
)
{
parent
::
__construct
(
$params
);
$previous
=
$this
->
_value
;
$this
->
_value
=
trim
((
new
Zend_Filter_Alnum
(
true
))
->
filter
(
$this
->
_value
));
$this
->
_element
->
setValue
(
$this
->
_value
);
if
(
$previous
!=
$this
->
_value
)
$this
->
_element
->
addError
(
$this
->
_
(
'Seuls les caractères alphanumériques sont autorisés'
));
}
protected
function
buildElement
()
{
return
new
Zend_Form_Element_Text
(
$this
->
getName
(),
[
'label'
=>
$this
->
_
(
'Commentaire contient'
)]);
}
public
function
acceptSearchVisitor
(
$visitor
)
{
if
(
!
$this
->
_value
)
return
;
$visitor
->
addWhereParam
(
'comment like "%'
.
$this
->
_value
.
'%"'
);
}
}
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment