fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17072] Added drop-down to select control status om y


From: erikhl
Subject: [Fmsystem-commits] [17072] Added drop-down to select control status om year-calendar
Date: Thu, 14 Sep 2017 07:51:01 -0400 (EDT)

Revision: 17072
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17072
Author:   erikhl
Date:     2017-09-14 07:51:00 -0400 (Thu, 14 Sep 2017)
Log Message:
-----------
Added drop-down to select control status om year-calendar

Modified Paths:
--------------
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/js/controller/ajax.js
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/templates/base/calendar/calendar_filters.xsl

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2017-09-13 18:50:52 UTC 
(rev 17071)
+++ trunk/controller/inc/class.uicalendar.inc.php       2017-09-14 11:51:00 UTC 
(rev 17072)
@@ -266,7 +266,10 @@
                        $role = phpgw::get_var('role', 'int');
 
                        $repeat_type = phpgw::get_var('repeat_type');
-
+                       
+                       //show only controls that are not done
+                       $selected_ctrl_status = 
phpgw::get_var('current_ctrl_status');
+                       
                        // Validates year. If year is not set, current year is 
chosen
                        $year = $this->validate_year($year);
 
@@ -348,7 +351,7 @@
                                        if ($control->get_repeat_type() == 
controller_control::REPEAT_TYPE_MONTH | $control->get_repeat_type() == 
controller_control::REPEAT_TYPE_YEAR)
                                        {
                                                $year_calendar = new 
year_calendar($control, $year, null, $location_code, "location");
-                                               $calendar_array = 
$year_calendar->build_calendar($control->get_check_lists_array());
+                                               $calendar_array = 
$year_calendar->build_calendar($control->get_check_lists_array(), 
$selected_ctrl_status);
 
                                                $controls_calendar_array[] = 
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
                                        }
@@ -422,6 +425,17 @@
                                        array('id' => "2", 'value' => "Måned"),
                                        array('id' => "3", 'value' => "År")
                                );
+                               
+                               $ctrl_status_array = array(
+                                       array('id' => "CONTROL_REGISTERED", 
'value' => "CONTROL_REGISTERED"),
+                                       array('id' => "CONTROL_PLANNED", 
'value' => "CONTROL_PLANNED"),
+                                       array('id' => 
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS", 'value' => 
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS"),
+                                       array('id' => 
"CONTROL_DONE_IN_TIME_WITHOUT_ERRORS", 'value' => 
"CONTROL_DONE_IN_TIME_WITHOUT_ERRORS"),
+                                       array('id' => 
"CONTROL_DONE_WITH_ERRORS", 'value' => "CONTROL_DONE_WITH_ERRORS"),
+                                       array('id' => "CONTROL_NOT_DONE", 
'value' => "CONTROL_NOT_DONE"),
+                                       //array('id' => 
"CONTROL_NOT_DONE_WITH_PLANNED_DATE", 'value' => 
"CONTROL_NOT_DONE_WITH_PLANNED_DATE"),
+                                       array('id' => "CONTROL_CANCELED", 
'value' => "CONTROL_CANCELED")
+                               );
 
                                $data = array
                                        (
@@ -434,9 +448,11 @@
                                        'location_level' => $level,
                                        'roles_array' => $roles_array,
                                        'repeat_type_array' => 
$repeat_type_array,
+                                       'ctrl_status_array' => 
$ctrl_status_array,
                                        'current_year' => $year,
                                        'current_role' => $role,
-                                       'current_repeat_type' => $repeat_type
+                                       'current_repeat_type' => $repeat_type,
+                                       'current_ctrl_status' => 
$selected_ctrl_status
                                );
 
                                phpgwapi_jquery::load_widget('autocomplete');

Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2017-09-13 
18:50:52 UTC (rev 17071)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2017-09-14 
11:51:00 UTC (rev 17072)
@@ -93,7 +93,7 @@
                        }
                }
 
-               public function build_calendar( $check_lists_array )
+               public function build_calendar( $check_lists_array, 
$ctrl_status = NULL )
                {
                        foreach ($check_lists_array as $check_list)
                        {
@@ -115,11 +115,12 @@
                                        
$this->calendar_array[$month_nr]["info"] = $check_list_status_info->serialize();
                                }
                        }
-//                     _debug_array($this->calendar_array);
+                       //_debug_array($this->calendar_array);
                        /*Insert code to remove controls with changed due-date 
from array*/
                        $m_cnt = 0;
                        $not_done_due_date;
                        $new_calendar_array = array();
+                       $new_calendar_array2 = array();
                        $found = false;
                        $moved_control_dates = NULL;
                        foreach ($this->calendar_array as $cal)
@@ -140,7 +141,7 @@
                                        $m_cnt++;
                                        if(is_array($cal2))
                                        {
-                                               if($cal2['info']['status'] == 
'CONTROL_NOT_DONE')
+                                               if($cal2['info']['status'] == 
'CONTROL_NOT_DONE' || $cal2['info']['status'] == 'CONTROL_REGISTERED')
                                                {
                                                        
if(in_array($cal2['info']['deadline_date_ts'], $moved_control_dates))
                                                        {
@@ -163,6 +164,51 @@
                                }
                                $this->calendar_array = $new_calendar_array;
                        }
+                       $m_cnt2 = 0;
+                       if(isset($ctrl_status))
+                       {
+                               if ($ctrl_status == "ALLE")
+                               {
+                                       //do nothing
+                               }
+                               else
+                               {
+                                       foreach ($this->calendar_array as $cal3)
+                                       {
+                                               $m_cnt2++;
+                                               if(is_array($cal3))
+                                               {
+                                                       if($ctrl_status == 
'CONTROL_NOT_DONE')
+                                                       {
+                                                               
if($cal3['info']['status'] == $ctrl_status || $cal3['info']['status'] == 
'CONTROL_NOT_DONE_WITH_PLANNED_DATE')
+                                                               {
+                                                                       
$new_calendar_array2[$m_cnt2] = $cal3;
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$new_calendar_array2[$m_cnt2] = NULL;
+                                                               }
+                                                       }
+                                                       else
+                                                       {
+                                                               
if($cal3['info']['status'] == $ctrl_status)
+                                                               {
+                                                                       
$new_calendar_array2[$m_cnt2] = $cal3;
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$new_calendar_array2[$m_cnt2] = NULL;
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       
$new_calendar_array2[$m_cnt2] = NULL;
+                                               }
+                                       }
+                                       $this->calendar_array = 
$new_calendar_array2;
+                               }
+                       }
                        return $this->calendar_array;
                }
 

Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2017-09-13 18:50:52 UTC (rev 
17071)
+++ trunk/controller/js/controller/ajax.js      2017-09-14 11:51:00 UTC (rev 
17072)
@@ -715,7 +715,16 @@
                $(thisForm).find("input[name=role]").val(role);
                $(thisForm).submit();
        });
+       
+       $("#filter-ctrl_status").change(function ()
+       {
+               var ctrl_status = $(this).val();
+               var thisForm = $(this).closest("form");
 
+               
$(thisForm).find("input[name=current_ctrl_status]").val(ctrl_status);
+               $(thisForm).submit();
+       });
+
        // SHOW INFO BOX: Fetches info about a check list on hover image icon
        $('a.view_info_box').bind('contextmenu', function ()
        {

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2017-09-13 18:50:52 UTC (rev 
17071)
+++ trunk/controller/setup/phpgw_no.lang        2017-09-14 11:51:00 UTC (rev 
17072)
@@ -393,6 +393,13 @@
 lang_control_mandatory_location        controller      no      Påkrevd 
lokasjonsvalg
 Control types  controller      no      Kontrolltyper
 location       controller      no      Lokasjon
+CONTROL_REGISTERED     controller      no      Kontroll satt opp
+CONTROL_PLANNED        controller      no      Kontroll har planlagt dato
+CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS  controller      no      Kontroll 
gjennomført uten åpne saker etter frist
+CONTROL_DONE_IN_TIME_WITHOUT_ERRORS    controller      no      Kontroll 
gjennomført uten åpne saker før frist
+CONTROL_DONE_WITH_ERRORS       controller      no      Kontroll gjennomført 
med åpne saker
+CONTROL_NOT_DONE       controller      no      Kontroll ikke gjennomført
+CONTROL_CANCELED       controller      no      Kontroll kansellert
 document types controller      no      Dokumenttyper
 Do not edit archived version   controller      no      Du kan ikke endre 
arkiverte versjoner
 choose a location      controller      no      Velg en lokasjon
\ No newline at end of file

Modified: trunk/controller/templates/base/calendar/calendar_filters.xsl
===================================================================
--- trunk/controller/templates/base/calendar/calendar_filters.xsl       
2017-09-13 18:50:52 UTC (rev 17071)
+++ trunk/controller/templates/base/calendar/calendar_filters.xsl       
2017-09-14 11:51:00 UTC (rev 17072)
@@ -42,6 +42,11 @@
         <xsl:value-of select="current_repeat_type"/>
       </xsl:attribute>
     </input>
+       <input type="hidden" name="current_ctrl_status">
+      <xsl:attribute name="value">
+        <xsl:value-of select="current_ctrl_status"/>
+      </xsl:attribute>
+    </input>
     <input type="hidden" name="role">
       <xsl:attribute name="value">
         <xsl:value-of select="current_role"/>
@@ -90,5 +95,28 @@
         </xsl:for-each>
       </select>
     </div>
+       <div class="filter">
+      <label>Filtrer på status</label>
+      <select id="filter-ctrl_status" name="ctrl_status">
+        <option value="ALLE">Velg status</option>
+        <xsl:for-each select="ctrl_status_array">
+                       <xsl:variable name="status_value">
+                               <xsl:value-of select="value"/>
+          </xsl:variable>
+          <xsl:choose>
+            <xsl:when test="id = //current_ctrl_status">
+              <option value="{id}" selected="selected">
+                <xsl:value-of disable-output-escaping="yes" 
select="php:function('lang', $status_value)"/>
+              </option>
+            </xsl:when>
+            <xsl:otherwise>
+              <option value="{id}">
+                <xsl:value-of disable-output-escaping="yes" 
select="php:function('lang', $status_value)"/>
+              </option>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each>
+      </select>
+    </div>
   </form>                              
 </xsl:template>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]