[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 06/13: Calendar : zoom and list mode
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 06/13: Calendar : zoom and list mode |
Date: |
Sun, 07 Jun 2015 17:57:23 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 9c687af58505a6d44d3f6a7efc8c407a1339b58f
Author: Dany De Bontridder <address@hidden>
Date: Fri Jun 5 21:26:51 2015 +0200
Calendar : zoom and list mode
---
html/js/scripts.js | 11 +++--
include/ajax_calendar_zoom.php | 10 +++-
include/calendar.inc.php | 2 +-
include/class_calendar.php | 77 +++++++++++++++++++++++++++++------
include/dashboard.inc.php | 4 +-
include/template/calendar-list.php | 61 ++++++++++++++++++++++++++++
include/template/calendar.php | 6 +++
7 files changed, 147 insertions(+), 24 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 3b78e5f..d32e337 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -2533,14 +2533,17 @@ function action_hide_checkbox()
function calendar_zoom(obj)
{
try {
-
- var query = "";
- query = "op=calendar_zoom&gDossier=" + obj.gDossier + "&in=" +
$(obj.invalue).value + '&out=' + obj.outdiv;
waiting_box();
+ var per_periode=null;
+ var notitle=0;
+ var from=0;
+ if ( $(obj.invalue) ) { per_periode=$(obj.invalue).value;}
+ if ( obj.notitle && obj.notitle==1 ) { notitle=1;}
var action = new Ajax.Request(
"ajax_misc.php",
{
- method: 'get', parameters: query,
+ method: 'get',
+ parameters: {
"notitle":notitle,"op":'calendar_zoom','from':from,'gDossier':obj.gDossier,'in':per_periode
,'out' : obj.outdiv,'distype':obj.distype},
onFailure: ajax_misc_failure,
onSuccess: function (req, j) {
var answer = req.responseXML;
diff --git a/include/ajax_calendar_zoom.php b/include/ajax_calendar_zoom.php
index 4d1e7dd..7c35b56 100644
--- a/include/ajax_calendar_zoom.php
+++ b/include/ajax_calendar_zoom.php
@@ -20,10 +20,14 @@
if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once 'class_calendar.php';
ob_start();
-echo HtmlInput::title_box(_("Calendrier"), "calendar_zoom_div");
+if ( $notitle== 0 ) echo HtmlInput::title_box(_("Calendrier"),
"calendar_zoom_div");
$cal=new Calendar();
-$cal->set_periode($_GET['in']);
-echo $cal->zoom();
+$in=HtmlInput::default_value_get('in',"");
+if ( $in == "") {
+ $in=$cal->get_preference();
+}
+$cal->set_periode($in);
+echo $cal->zoom($distype);
$response= ob_get_clean();
$html=escape_xml($response);
diff --git a/include/calendar.inc.php b/include/calendar.inc.php
index ddea619..fb2f7be 100644
--- a/include/calendar.inc.php
+++ b/include/calendar.inc.php
@@ -15,5 +15,5 @@ $cal->default_periode=(isset
($_GET['in']))?$_GET['in']:$g_user->get_periode();
?>
<div id="calendar_zoom_div">
-<?php echo $cal->display('long'); ?>
+<?php echo $cal->display('long',true); ?>
</div>
\ No newline at end of file
diff --git a/include/class_calendar.php b/include/class_calendar.php
index 5dff886..9df931f 100644
--- a/include/class_calendar.php
+++ b/include/class_calendar.php
@@ -150,7 +150,7 @@ class Calendar
*
*\return HTML String
*/
- function display($p_type)
+ function display($p_type,$p_notitle=false)
{
global $g_user;
if ($p_type != 'long' && $p_type != 'short') {
@@ -179,16 +179,18 @@ class Calendar
$month_year=$wMonth->input().$wMonth->get_js_attr();
ob_start();
$zoom=($p_type=='short')?0:1;
+ $notitle=($p_notitle)?1:0;
+
require_once('template/calendar.php');
- if (count($this->action_div) > 0)
- {
- foreach ($this->action_div as $day)
- {
- echo $day;
- }
- }
- $ret=ob_get_contents();
+ if (count($this->action_div) > 0)
+ {
+ foreach ($this->action_div as $day)
+ {
+ echo $day;
+ }
+ }
+ $ret=ob_get_contents();
ob_end_clean();
return $ret;
}
@@ -227,7 +229,7 @@ class Calendar
{
$p_id=$g_user->get_periode();
}
- $this->default_periode=$p_id;
+ $this->default_periode=$p_id;
return $p_id;
}
/**
@@ -241,7 +243,7 @@ class Calendar
/**
* @brief zoom the calendar
*/
- function zoom()
+ function zoom_calendar()
{
global $g_user;
$exercice_user=$g_user->get_exercice();
@@ -261,12 +263,13 @@ class Calendar
$cn=new Database(dossier::id());
$wMonth->value=$cn->make_array("select p_id,to_char(p_start,'MM/YYYY')
from parm_periode where p_exercice = '$exercice_user' order by p_start");
$wMonth->selected=$this->default_periode;
-
$wMonth->javascript=sprintf("onchange=calendar_zoom({gDossier:%d,invalue:'%s',outvalue:'%s'})",
- dossier::id(),'per_div','calendar_zoom_div');
+
$wMonth->javascript=sprintf("onchange=calendar_zoom({gDossier:%d,invalue:'%s',outvalue:'%s',distype:'%s'})",
+ dossier::id(),'per_div','calendar_zoom_div','cal');
$wMonth->set_attribute('gDossier',dossier::id());
$month_year=$wMonth->input().$wMonth->get_js_attr();
- $zoom=1;
ob_start();
+ $zoom=1;
+ $notitle=HtmlInput::default_value_get('notitle', 0);
require_once('template/calendar.php');
if (count($this->action_div) > 0)
@@ -280,6 +283,52 @@ class Calendar
ob_end_clean();
return $ret;
}
+ /**
+ * Display the next events for 30 days
+ * todo list + action to remind
+ */
+ function zoom_list()
+ {
+ global $g_user;
+ $cn=new Database(dossier::id());
+ $profile=$g_user->get_profile();
+
+ // Get the event from now and before 30 before
+ // union the TODO list
+ $sql = "
+ select ag_id,ag_remind_date,to_char(ag_remind_date,'DD.MM.YY') as
str_date,ag_title,ag_hour,
+ coalesce(name,'interne') as str_name
+ from action_gestion
+ left join vw_fiche_name on (f_id=f_id_dest)
+ where
+ ag_remind_date >= now()
+ and ag_dest in (select p_granted from user_sec_action_profile
where p_id =$1)
+ and ag_state IN (2, 3)
+ order by ag_remind_date,ag_hour
+ ";
+ $a_event=$cn->get_array($sql,array($profile));
+ $notitle=HtmlInput::default_value_get('notitle', 0);
+ ob_start();
+ require_once 'template/calendar-list.php';
+ $ret=ob_get_clean();
+ return $ret;
+
+
+ }
+
+ function zoom($p_type)
+ {
+ switch ($p_type)
+ {
+ case 'cal':
+ return $this->zoom_calendar();
+ break;
+ case 'list':
+ return $this->zoom_list();
+ break;
+ }
+ }
+
static function test_me() {
}
diff --git a/include/dashboard.inc.php b/include/dashboard.inc.php
index 4783f95..52323ba 100644
--- a/include/dashboard.inc.php
+++ b/include/dashboard.inc.php
@@ -21,8 +21,8 @@ global $g_user;
$cal=new Calendar();
$cal->get_preference();
-$obj=sprintf("{gDossier:%d,invalue:'%s',outdiv:'%s'}",
- dossier::id(),'per','calendar_zoom_div');
+$obj=sprintf("{gDossier:%d,invalue:'%s',outdiv:'%s','distype':'%s'}",
+ dossier::id(),'per','calendar_zoom_div','cal');
$Operation=new Follow_Up($cn);
$last_operation=$Operation->get_today();
$late_operation=$Operation->get_late();
diff --git a/include/template/calendar-list.php
b/include/template/calendar-list.php
new file mode 100644
index 0000000..ca9af88
--- /dev/null
+++ b/include/template/calendar-list.php
@@ -0,0 +1,61 @@
+<?php
+/*
+ * * Copyright (C) 2015 Dany De Bontridder <address@hidden>
+*
+* 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.
+*
+* This program 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ *
+ */
+
+
+/**
+ * @file
+ * @brief display the calendar as a list. Included from the
Calendar::zoom_list()
+ */
+?>
+<div class="content" id="user_cal" style="width:100%">
+<?php
+ $short=HtmlInput::default_value_get('from', 0);
+
$js=sprintf("calendar_zoom({gDossier:%d,invalue:'%s',outvalue:'%s',distype:'%s','notitle':%d})",
+ dossier::id(),'per_div','calendar_zoom_div','cal',$notitle);
+ echo HtmlInput::anchor(_('Calendrier'),''," onclick=\"{$js}\"") ;
+?>
+ <table class="result">
+<?php
+ $nb_event=count($a_event);
+ for ($i=0;$i<$nb_event;$i++):
+ $class=($i % 2 == 0 )? 'even':'odd';
+?>
+ <tr class="<?php echo $class?>">
+ <td>
+ <?php echo $a_event[$i]['str_date']; ?>
+
+ <?php echo $a_event[$i]['ag_hour']; ?>
+ </td>
+ <td>
+ <?php echo
HtmlInput::detail_action($a_event[$i]["ag_id"],$a_event[$i]["ag_title"]);?>
+ </td>
+ <td>
+ <?php echo h($a_event[$i]['ag_title']); ?>
+ </td>
+ </tr>
+
+<?php
+ endfor;
+?>
+ </table>
+
+
+</div>
\ No newline at end of file
diff --git a/include/template/calendar.php b/include/template/calendar.php
index ca1f06c..581e27c 100644
--- a/include/template/calendar.php
+++ b/include/template/calendar.php
@@ -4,6 +4,12 @@
?>
<div class="pc_calendar" id="user_cal" style="width:100%">
<?php echo $month_year?>
+<?php
+
$js=sprintf("calendar_zoom({gDossier:%d,invalue:'%s',outvalue:'%s',distype:'%s','notitle':%d})",
+ dossier::id(),'per_div','calendar_zoom_div','list',$notitle);
+ echo HtmlInput::anchor(_('Liste'),''," onclick=\"{$js}\"") ;
+ ?>
+
<?php if ($zoom == 1 ): ?>
<table style="width:100%;height:80%">
<?php else: ?>
- [Noalyss-commit] [noalyss] branch master updated (6abc662 -> 71a7a72), Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 01/13: Task #1126 - Réécriture de la partie administration Effacement des plugins et todo list, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 02/13: Task #1126 - Réécriture de la partie administration Cosmetic, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 03/13: Cosmetic, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 04/13: comment, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 05/13: Fix bug in todo list, add an empty table if nothing, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 07/13: Calendar : zoom and list mode, fix height, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 06/13: Calendar : zoom and list mode,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 08/13: Calendar : zoom and list mode, fix height, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 09/13: Calendar : highlight late action, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 11/13: Documentation, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 12/13: Esthétique, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 10/13: remove style for icon in menu, Dany De Bontridder, 2015/06/07
- [Noalyss-commit] [noalyss] 13/13: Task #1092 - Ageing report Balance agée : Possibilité d'entrer une date pour les opérations entrées après cette date, Dans les fiches, pour un seul client ou fournisseur Dans les catégories de fiches : pour une catégorie de clients ou de fournisseurs ou toutes les fiches Général pour toutes les fiches clients ou fournisseurs. export CSV, Dany De Bontridder, 2015/06/07