fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10572] property: More on condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10572] property: More on condition survey
Date: Wed, 05 Dec 2012 20:57:43 +0000

Revision: 10572
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10572
Author:   sigurdne
Date:     2012-12-05 20:57:42 +0000 (Wed, 05 Dec 2012)
Log Message:
-----------
property: More on condition survey

Modified Paths:
--------------
    trunk/property/inc/class.interlink.inc.php
    trunk/property/inc/class.socondition_survey.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/js/yahoo/request.edit.js
    trunk/property/templates/base/condition_survey.xsl

Modified: trunk/property/inc/class.interlink.inc.php
===================================================================
--- trunk/property/inc/class.interlink.inc.php  2012-12-05 14:52:23 UTC (rev 
10571)
+++ trunk/property/inc/class.interlink.inc.php  2012-12-05 20:57:42 UTC (rev 
10572)
@@ -234,6 +234,10 @@
                        {
                                $link = array('menuaction' => 
"property.uirequest.{$function}", 'id' => $id);
                        }
+                       else if($type == '.project.condition_survey')
+                       {
+                               $link = array('menuaction' => 
"property.uicondition_survey.{$function}", 'id' => $id);
+                       }
                        else if($type == '.project')
                        {
                                $link = array('menuaction' => 
"property.uiproject.{$function}", 'id' => $id);
@@ -319,6 +323,15 @@
                                return $relation_info;
 
                        }
+                       else if($type == '.project.condition_survey')
+                       {
+                               $this->_db->query("SELECT 
fm_condition_survey.title, fm_condition_survey_status.descr as status FROM 
fm_condition_survey {$this->_join} fm_condition_survey_status ON 
fm_condition_survey.status_id = fm_condition_survey_status.id WHERE 
fm_condition_survey.id = {$id}",__LINE__,__FILE__);                           
+                               $this->_db->next_record();
+                               $relation_info['statustext'] = 
$this->_db->f('status');
+                               $relation_info['title'] = 
$this->_db->f('title');
+                               return $relation_info;
+
+                       }
                        else if($type == '.project')
                        {               
                                $this->_db->query("SELECT fm_project.name as 
title, fm_project_status.descr as status FROM fm_project {$this->_join} 
fm_project_status ON fm_project.status = fm_project_status.id WHERE 
fm_project.id = {$id}",__LINE__,__FILE__);

Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2012-12-05 14:52:23 UTC 
(rev 10571)
+++ trunk/property/inc/class.socondition_survey.inc.php 2012-12-05 20:57:42 UTC 
(rev 10572)
@@ -433,19 +433,20 @@
 
                        $sorequest      = CreateObject('property.sorequest');
 
-_debug_array($survey);                 
+//_debug_array($survey);                       
 
                        $this->_db->transaction_begin();
 
                        foreach ($import_data as $entry)
                        {
-                               if( $entry['condition_degree'] )
+                               if( ctype_digit($entry['condition_degree']) &&  
$entry['condition_degree'] > 0)
                                {
                                        $request = array();
                                        $request['street_name'] = 
$location_data['street_name'];
                                        $request['street_number'] = 
$location_data['street_number'];
                                        $request['location'] = $location;
-                                       $request['origin'] = 
array(array('location' => '.project.condition_survey', 'id' => 
(int)$survey['id']));
+                                       $request['location_code'] = 
$survey['location_code'];
+                                       $request['origin'] = 
array(array('location' => '.project.condition_survey', 'data' => 
array(array('id' => (int)$survey['id']))));
 
                                        $request['title'] = $entry['title'];
                                        $request['descr'] = $entry['descr'];
@@ -466,15 +467,12 @@
                                                        'probability' => 
$entry['probability']
                                                )
                                        );
+//_debug_array($request);
+                                       $sorequest->add($request, 
$values_attribute = array());
                                }
-
-_debug_array($request);
-               //              $sorequest->add($request, $values_attribute = 
array())
-
                        }
-               die();
+//             die();
 
-
                        $this->_db->transaction_commit();
                }
 

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2012-12-05 14:52:23 UTC (rev 
10571)
+++ trunk/property/inc/class.sorequest.inc.php  2012-12-05 20:57:42 UTC (rev 
10572)
@@ -781,7 +781,6 @@
 
                function add($request, $values_attribute = array())
                {
-//                     _debug_array($request);die();
                        $receipt = array();
 
                        $value_set = array();
@@ -801,6 +800,7 @@
                                        $value_set[$input_name] = $value;
                                }
                        }
+//     _debug_array($value_set);die();
 
                        $data_attribute = 
$this->custom->prepare_for_db('fm_request', $values_attribute);
                        if(isset($data_attribute['value_set']))
@@ -896,6 +896,7 @@
                                
$this->soproject->update_power_meter($request['power_meter'],$request['location_code'],$address);
                        }
 
+//_debug_array($request['origin']);
                        if(is_array($request['origin']) && 
isset($request['origin'][0]['data'][0]['id']))
                        {
                                $interlink_data = array
@@ -909,6 +910,7 @@
 
                                
$this->interlink->add($interlink_data,$this->db);
                        }
+//_debug_array($interlink_data);die();
 
                        $sql = "SELECT * FROM fm_request_status WHERE 
id='{$request['status']}'";
                        $this->db->query($sql,__LINE__,__FILE__);

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-05 14:52:23 UTC 
(rev 10571)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-05 20:57:42 UTC 
(rev 10572)
@@ -47,6 +47,7 @@
                        'get_users'                     => true,
                        'edit_survey_title'     => true,
                        'get_files'                     => true,
+                       'get_related'           => true,
                        'view_file'                     => true,
                        'import'                        => true
                );
@@ -305,7 +306,8 @@
                        $tabs['generic']        = array('label' => 
lang('generic'), 'link' => '#generic');
                        $active_tab = 'generic';
                        $tabs['documents']      = array('label' => 
lang('documents'), 'link' => null);
-                       $tabs['import'] = array('label' => lang('import'), 
'link' => null);
+                       $tabs['import']         = array('label' => 
lang('import'), 'link' => null);
+                       $tabs['related']        = array('label' => 
lang('related'), 'link' => null);
 
                        if ($id)
                        {
@@ -314,6 +316,7 @@
                                        $tabs['import']['link'] = '#import';
                                }
                                $tabs['documents']['link'] = '#documents';
+                               $tabs['related']['link'] = '#related';
 
                                if (!$values)
                                {
@@ -359,6 +362,23 @@
                        
                        );
 
+                       $related_def = array
+                       (
+                               array('key' => 
'url','label'=>lang('id'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'status','label'=>lang('status'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'user','label'=>lang('user'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 
'entry_date','label'=>lang('entry date'),'sortable'=>false,'resizeable'=>true),
+                       );
+
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_1',
+                               'requestUrl'    => 
json_encode(self::link(array('menuaction' => 
'property.uicondition_survey.get_related', 'id' => 
$id,'phpgw_return_as'=>'json'))),
+                               'ColumnDefs'    => json_encode($related_def)
+                       );
+
                        $data = array
                        (
                                'datatable_def'                                 
=> $datatable_def,
@@ -505,7 +525,41 @@
                        return array('ResultSet'=> array('Result'=>$values), 
'totalResultsAvailable' => count($values));
                }
 
+               function get_related()
+               {
+                       $id     = phpgw::get_var('id', 'REQUEST', 'int');
 
+                       if( !$this->acl_read)
+                       {
+                               return;
+                       }
+               
+                       $interlink      = CreateObject('property.interlink');
+                       $target = $interlink->get_relation('property', 
$this->acl_location, $id, 'target');
+
+                       $values = array();
+                       if($target)
+                       {
+                               foreach($target as $_target_section)
+                               {
+                                       foreach ($_target_section['data'] as 
$_target_entry)
+                                       {
+                                               $values[] = array
+                                               (
+                                                       'url'           => "<a 
href=\"{$_target_entry['link']}\" > {$_target_entry['id']}</a>",
+                                                       'type'          => 
$_target_section['descr'],
+                                                       'title'         => 
$_target_entry['title'],
+                                                       'status'        => 
$_target_entry['statustext'],
+                                                       'user'          => 
$GLOBALS['phpgw']->accounts->get($_target_entry['account_id'])->__toString(),
+                                                       'entry_date'=> 
$GLOBALS['phpgw']->common->show_date($_target_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                               );
+                                       }
+                               }
+                       }
+                       return array('ResultSet'=> array('Result'=>$values), 
'totalResultsAvailable' => count($values));
+               }
+
+
                /**
                * Dowloads a single file to the browser
                *

Modified: trunk/property/js/yahoo/request.edit.js
===================================================================
--- trunk/property/js/yahoo/request.edit.js     2012-12-05 14:52:23 UTC (rev 
10571)
+++ trunk/property/js/yahoo/request.edit.js     2012-12-05 20:57:42 UTC (rev 
10572)
@@ -36,6 +36,10 @@
                myfoot.appendChild(newTR);
        }
        
+       this.myParticularRenderEvent = function()
+       {
+       }
+
 
/********************************************************************************/
     
        var FormatterCenter = function(elCell, oRecord, oColumn, oData)
        {

Modified: trunk/property/templates/base/condition_survey.xsl
===================================================================
--- trunk/property/templates/base/condition_survey.xsl  2012-12-05 14:52:23 UTC 
(rev 10571)
+++ trunk/property/templates/base/condition_survey.xsl  2012-12-05 20:57:42 UTC 
(rev 10572)
@@ -226,31 +226,36 @@
                                        </xsl:choose>
                                </dl>
                        </div>
-                       <xsl:choose>
-                               <xsl:when test="editable = 1">
-                                       <div id="import">
-                               <dl class="proplist-col">
-
-                                                               <dt>
-                                                                       
<label><xsl:value-of select="php:function('lang', 'upload file')"/></label>
-                                                               </dt>
-                                                               <dd>
-                                                                       <input 
type="file" name="import_file" size="40">
-                                                                               
<xsl:attribute name="title">
-                                                                               
        <xsl:value-of select="php:function('lang', 'Select file to upload')"/>
-                                                                               
</xsl:attribute>
-                                                                       </input>
-                                                               </dd>
-
+                       <div id="import">
+                               <xsl:choose>
+                                       <xsl:when test="editable = 1">
+                                               <dl class="proplist-col">
+                                                       <dt>
+                                                               
<label><xsl:value-of select="php:function('lang', 'upload file')"/></label>
+                                                       </dt>
+                                                       <dd>
+                                                               <input 
type="file" name="import_file" size="40">
+                                                                       
<xsl:attribute name="title">
+                                                                               
<xsl:value-of select="php:function('lang', 'Select file to upload')"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                       </dd>
                                                </dl>
-                                       </div>
                                </xsl:when>
-                               </xsl:choose>
-                               </div>
-
+                       </xsl:choose>
+                       </div>
+                       <div id="related">
                                <dl class="proplist-col">
-
-
+                                       <dt>
+                                               <label><xsl:value-of 
select="php:function('lang', 'related')"/></label>
+                                       </dt>
+                                       <dd>
+                                               <div style="clear:both;" 
id="datatable-container_1"></div>
+                                       </dd>
+                               </dl>
+                       </div>
+                       </div>
+                               <dl class="proplist-col">
                                                <div class="form-buttons">
                                                        <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
                                                        <xsl:choose>




reply via email to

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