fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13429] more on controller


From: Sigurd Nes
Subject: [Fmsystem-commits] [13429] more on controller
Date: Sat, 13 Jun 2015 18:30:55 +0000

Revision: 13429
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13429
Author:   sigurdne
Date:     2015-06-13 18:30:54 +0000 (Sat, 13 Jun 2015)
Log Message:
-----------
more on controller

Modified Paths:
--------------
    trunk/controller/inc/class.uicomponent.inc.php
    trunk/controller/templates/base/component.xsl
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.uientity.inc.php

Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php      2015-06-12 22:07:47 UTC 
(rev 13428)
+++ trunk/controller/inc/class.uicomponent.inc.php      2015-06-13 18:30:54 UTC 
(rev 13429)
@@ -203,7 +203,11 @@
                        $location_filter = $this->get_location_filter();
                        array_unshift($location_filter, array('id' => '', 
'name' => lang('select value')));
 
-
+                       $filter_component = '';
+                       if(phpgw::get_var('component_id', 'int'))
+                       {
+                               $filter_component = 
phpgw::get_var('location_id', 'int') . '_' . phpgw::get_var('component_id', 
'int');
+                       }
                        $data = array(
                                'datatable_name' => lang('status components'),
                                'form'                   => array(
@@ -259,23 +263,33 @@
                                                                'value'  => 1,
                                                                'onclick'       
=> 'update_table();'
                                                        ),
+                                                       array('type'     => 
'hidden',
+                                                               'name'   => 
'filter_component',
+                                                               'text'   => '',
+                                                               'value'  => 
$filter_component
+                                                       ),
                                                ),
                                        ),
                                ),
                                'datatable'              => array(
                                        'source' => 
self::link(array('menuaction' => 'controller.uicomponent.index',
                                                'phpgw_return_as' => 'json')),
-                                       'field'  =>  $this->get_fields(),
+                                       'field'  =>  
$this->get_fields($filter_component),
                                ),
                        );
                        self::render_template_xsl(array('component'), $data);
                }
 
-               private function get_fields()
+               private function get_fields($filter_component = '')
                {
                        $fields = array
                        (
                                array(
+                                       'key'            => 'selected',
+                                       'label'          => '',
+                                       'sortable'       => false,
+                               ),
+                               array(
                                        'key'            => 'component_id',
                                        'label'          => lang('component'),
                                        'sortable'       => true,
@@ -351,6 +365,7 @@
                                        'sortable'       => true,
                                ),
                        );
+
                        return $fields;
                }
 
@@ -365,6 +380,12 @@
                        $year = phpgw::get_var('year', 'int');
                        $all_items = phpgw::get_var('all_items', 'bool');
                        $filter_status = phpgw::get_var('status', 'string');
+                       if($filter_component_str = 
phpgw::get_var('filter_component', 'string'))
+                       {
+                               $filter_component_arr = explode('_', 
$filter_component_str);
+                               $location_id = $filter_component_arr[0];
+                               $filter_component = $filter_component_arr[1];
+                       }
 
                        $so_control                      = 
CreateObject('controller.socontrol');
                        $this->so                       = 
CreateObject('controller.socheck_list');
@@ -416,12 +437,13 @@
                                        $exclude_locations[] = $_location_id;
 
                                        $_components = 
execMethod('property.soentity.read',array(
-                                               'filter_entity_group' => 
$entity_group_id,
-                                               'location_id' => $_location_id,
-                                               'district_id' => $district_id,
-                                               'allrows' => true,
-                                               'control_registered' => 
!$all_items,
-                                               'check_for_control' => true
+                                               'filter_entity_group'           
=> $entity_group_id,
+                                               'location_id'                   
        => $_location_id,
+                                               'district_id'                   
        => $district_id,
+                                               'allrows'                       
                => true,
+                                               'control_registered'            
=> !$all_items,
+                                               'check_for_control'             
        => true,
+                                               'filter_item'                   
        => $filter_component
                                                )
                                        );
                                        $components = array_merge($components, 
$_components);
@@ -447,7 +469,6 @@
                        $all_components = array();
                        $components_with_calendar_array = array();
 //                     _debug_array($components);
-                       $have_been_here_before = array();
                        foreach($components as $_component)
                        {
                                $location_id = $_component['location_id'];
@@ -508,11 +529,6 @@
                                        {
                                                
foreach($components_for_control_array as $component)
                                                {
-                                                       
if($have_been_here_before[$component->get_id()])
-                                                       {
-                                                               continue;
-                                                       }
-                                                       
$have_been_here_before[$component->get_id()] = true;
 
                                                        
$component->set_xml_short_desc(" 
{$location_type_name[$location_id]}</br>{$short_description}");
 
@@ -676,6 +692,14 @@
 
                                if(!isset($entry['missing_control']))
                                {
+                                       if($filter_component_str)
+                                       {
+                                               $row['selected'] = '<input 
id="selected_component" type="checkbox" name="selected_component" checked = 
"checked" onclick="deselect_component();">';
+                                       }
+                                       else
+                                       {
+                                               $row['selected'] = '';
+                                       }
                                        $row['year'] = $year;
                                        $row['descr'] = 
"Frekvens<br/>Status<br/>Utførende<br/>Tidsbruk";
                                }
@@ -699,7 +723,7 @@
                                        $data_set[] = $row;
                                }
                        }
-                       $fields = $this->get_fields();
+                       $fields = $this->get_fields($filter_component_str);
                        $class = '';
                        $tbody = '';
                        foreach($data_set as $row_data )

Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl       2015-06-12 22:07:47 UTC 
(rev 13428)
+++ trunk/controller/templates/base/component.xsl       2015-06-13 18:30:54 UTC 
(rev 13429)
@@ -180,6 +180,15 @@
 <xsl:template name="datasource-definition">
        <script type="text/javascript">
 <![CDATA[
+               $(document).ready(function(){
+                       update_table();
+               });
+
+               deselect_component = function()
+               {
+                       $("[name='filter_component']").val('');
+                       update_table();
+               };
                update_table = function()
                {
                        var requestUrl = $("#queryForm").attr("action");
@@ -253,6 +262,8 @@
        <table id="components">
                <thead>
                        <tr>
+                               <td id='selected'>
+                               </td>
                                <td id='total_records'>
                                </td>
                                <td id='sum_text'>

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2015-06-12 22:07:47 UTC (rev 
13428)
+++ trunk/property/inc/class.soentity.inc.php   2015-06-13 18:30:54 UTC (rev 
13429)
@@ -447,6 +447,7 @@
                        $location_id            = isset($data['location_id']) 
&& $data['location_id'] ? (int)$data['location_id'] : 0;
                        $entity_group_id        = 
isset($data['entity_group_id']) && $data['entity_group_id'] ? 
(int)$data['entity_group_id'] : 0;
                        $filter_entity_group= 
isset($data['filter_entity_group']) && $data['filter_entity_group'] ? 
(int)$data['filter_entity_group'] : 0;
+                       $filter_item            = isset($data['filter_item']) 
&& $data['filter_item'] ? (int)$data['filter_item'] : 0;
 
 
                        if($location_id)
@@ -614,6 +615,12 @@
                                $where= 'AND';
                        }
 
+                       if ($filter_item)
+                       {
+                               $filtermethod .= " {$where} {$entity_table}.id 
= {$filter_item}";
+                               $where= 'AND';
+                       }
+
                        $_querymethod = array();
                        $__querymethod = array();
                        $_joinmethod_datatype = array();
@@ -1338,6 +1345,7 @@
                        $org_units              = isset($data['org_units']) && 
is_array($data['org_units']) ? $data['org_units'] : array();
                        $location_id    = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
                        $entity_group_id= isset($data['entity_group_id']) && 
$data['entity_group_id'] ? (int)$data['entity_group_id'] : 0;
+                       $filter_entity_group= 
isset($data['filter_entity_group']) && $data['filter_entity_group'] ? 
(int)$data['filter_entity_group'] : 0;
 
 
                        if($location_id)
@@ -1524,6 +1532,17 @@
                                $where= 'AND';
                        }
 
+                       if ($entity_group_id)
+                       {
+                               $filtermethod .= " {$where} 
{$entity_table}.entity_group_id = {$entity_group_id}";
+                               $where= 'AND';
+                       }
+                       if ($filter_entity_group)
+                       {
+                               $filtermethod .= " {$where} 
{$entity_table}.entity_group_id IS NULL";
+                               $where= 'AND';
+                       }
+
                        $_querymethod = array();
                        $__querymethod = array();
                        $_joinmethod_datatype = array();

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2015-06-12 22:07:47 UTC (rev 
13428)
+++ trunk/property/inc/class.uientity.inc.php   2015-06-13 18:30:54 UTC (rev 
13429)
@@ -3583,6 +3583,7 @@
                        $controls = 
execMethod('controller.socontrol.get_controls_at_component', 
array('location_id' => $location_id, 'component_id' => $id));
                        foreach($controls as &$entry)
                        {
+/*
                                $menuaction     = 
'controller.uicalendar.view_calendar_year_for_locations';
                                if($entry['repeat_type'] < 2)
                                {
@@ -3597,6 +3598,17 @@
                                        'component_id'  => $id,
                                        'serie_id'              => 
$entry['serie_id']
                                );
+*/
+
+                               $menuaction     = 
'controller.uicomponent.index';
+
+                               $control_link_data = array
+                               (
+                                       'menuaction'    => $menuaction,
+                                       'location_id'   => $location_id,
+                                       'component_id'  => $id,
+                               );
+
                                $entry['title'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$control_link_data).'" 
target="_blank">'.$entry['title'].'</a>';
 
                                $entry['start_date'] =  
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);




reply via email to

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