diff --git a/html/js/scripts.js b/html/js/scripts.js index 3b78e5f81..d32e337b7 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 4d1e7dd6b..7c35b5620 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 ddea61931..fb2f7be79 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(); ?>
-display('long'); ?> +display('long',true); ?>
\ No newline at end of file diff --git a/include/class_calendar.php b/include/class_calendar.php index 5dff886a2..9df931f4d 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 4783f9546..52323baec 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 000000000..ca9af88ea --- /dev/null +++ b/include/template/calendar-list.php @@ -0,0 +1,61 @@ + +* +* 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() + */ +?> +
+ + + + + + + + + + +
+ +   + + + + + +
+ + +
\ No newline at end of file diff --git a/include/template/calendar.php b/include/template/calendar.php index ca1f06cf4..581e27c60 100644 --- a/include/template/calendar.php +++ b/include/template/calendar.php @@ -4,6 +4,12 @@ ?>
+ +