fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10349]


From: Torstein
Subject: [Fmsystem-commits] [10349]
Date: Thu, 25 Oct 2012 09:04:43 +0000

Revision: 10349
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10349
Author:   vator
Date:     2012-10-25 09:04:42 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
    trunk/logistic/templates/base/css/base.css

Added Paths:
-----------
    trunk/logistic/templates/base/allocation/allocation_suggestions.xsl

Removed Paths:
-------------
    trunk/logistic/templates/base/allocation/allocation_item.xsl

Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2012-10-25 07:23:14 UTC (rev 10348)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2012-10-25 09:04:42 UTC (rev 10349)
@@ -152,51 +152,7 @@
 
                public function query()
                {
-/*                     $params = array(
-                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
-                               'query' => phpgw::get_var('query'),
-                               'sort' => phpgw::get_var('sort'),
-                               'dir' => phpgw::get_var('dir'),
-                               'filters' => $filters
-                       );
 
-                 $entity_id                    = phpgw::get_var('entity_id', 
'int');
-                       $cat_id                         = 
phpgw::get_var('cat_id', 'int');
-                       $district_id            = phpgw::get_var('district_id', 
'int');
-                       $part_of_town_id        = 
phpgw::get_var('part_of_town_id', 'int');
-                       $control_id                     = 
phpgw::get_var('control_id', 'int');
-                       $results                        = 
phpgw::get_var('results', 'int');
-
-
-                       if(!$entity_id && !$cat_id)
-                       {
-                               $values = array();
-                       }
-                       else
-                       {
-
-                       $entity_id = 3;
-                       $cat_id = 1;
-                               $location_id = 
2295;//$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
-                               //$boentity     = 
CreateObject('property.boentity',false, 'entity');
-                               $boentity       = 
CreateObject('property.boentity',false, 'entity', $entity_id, $cat_id);
-                               $boentity->results = $results;
-                               //$values = 
$boentity->read(array('control_registered' => $control_registered, 'control_id' 
=> $control_id));
-                               $values = $boentity->read();
-                       //}
-
-                       $results = $results ? $results : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-
-                       $result_data = array('results' => $values);
-
-                       $result_data['total_records'] = 
$boentity->total_records;
-                       $result_data['start'] = $params['start'];
-                       $result_data['sort'] = $params['sort'];
-                       $result_data['dir'] = $params['dir'];
-
-                       return $this->yui_results($result_data);
- *
- */
                        $params = array(
                                'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
                                'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
@@ -281,9 +237,6 @@
 
                public function edit()
                {
-                       $entity_admin_so        = 
CreateObject('property.soadmin_entity');
-                       $entity_so      = CreateObject('property.soentity');
-                       $custom = createObject('phpgwapi.custom_fields');
                        $activity_id = phpgw::get_var('activity_id');
                        $requirement_id = phpgw::get_var('requirement_id');
                        $allocation_id = phpgw::get_var('id');
@@ -306,128 +259,83 @@
                                $allocation = new 
logistic_requirement_resource_allocation();
                        }
 
+                       $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
 
-                       if (isset($_POST['save_allocation']))
+                       if($requirement)
                        {
-                               
$allocation->set_requirement_id(phpgw::get_var('requirement_id'));
-                               
$allocation->set_article_id(phpgw::get_var('article_id'));
-                               $allocation->set_type(phpgw::get_var('type'));
+                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
+                               $entity_arr = explode('.',$loc_arr['location']);
 
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uirequirement_resource_allocation.view', 'id' 
=> $allocation_id));
-                       }
-                       else
-                       {
-                               $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
+                               $requirement_values = 
$this->so_requirement_value->get(null, null, null, null, null, null, 
array('requirement_id' => $requirement->get_id()));
 
-                               if($requirement)
-                               {
-                                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
-                                       $entity_arr = 
explode('.',$loc_arr['location']);
+                               $criterias_array = array();
+                               
+                               $location_id = $requirement->get_location_id();
+                               
+                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $entity_arr = explode('.',$loc_arr['location']);
 
-                                       $requirement_values = 
$this->so_requirement_value->get(null, null, null, null, null, null, 
array('requirement_id' => $requirement->get_id()));
-
-                                       $criterias_array = array();
+                               $entity_id = $entity_arr[2];
+                               $cat_id = $entity_arr[3];
+                               
+                               $criterias_array['location_id'] = $location_id;
+                               $criterias_array['allrows'] = true;
+                               
+                               foreach($requirement_values as 
$requirement_value)
+                               {
+                                       $attrib_value = 
$requirement_value->get_value();
+                                       $operator = 
$requirement_value->get_operator();
+                                       $cust_attribute_id = 
$requirement_value->get_cust_attribute_id();
                                        
-                                       $location_id = 
$requirement->get_location_id();
-                                       echo "Skriver ut: ";
+                                       if($operator == "eq")
+                                       {
+                                               $operator_str = "=";
+                                       }
+                                       else if($operator == "lt")
+                                       {
+                                               $operator_str = "<";
+                                       }
+                                       else if($operator == "gt")
+                                       {
+                                               $operator_str = ">";
+                                       }
                                        
-                                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
-                                       $entity_arr = 
explode('.',$loc_arr['location']);
+                                       $criteria_str = $column_name . " " . 
$operator_str . " " . $attrib_value;
 
-                                       $entity_id = $entity_arr[2];
-                                       $cat_id = $entity_arr[3];
+                                       $condition = array(
+                                               'operator'              => 
$operator_str,
+                                               'value'                         
=> $attrib_value,
+                                               'attribute_id' => 
$cust_attribute_id
+                                       );
                                        
-                                       foreach($requirement_values as 
$requirement_value)
-                                       {
-                                               $attrib_value = 
$requirement_value->get_value();
-                                               $operator = 
$requirement_value->get_operator();
-                                               $cust_attribute_id = 
$requirement_value->get_cust_attribute_id();
-                                               
-                                               $attrib_data = 
$custom->get('property', ".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
-                                               
-                                               $column_name = 
$attrib_data['column_name'];
-                                               
-                                               
-                                               if($operator == "eq")
-                                               {
-                                                       $operator_str = "=";
-                                               }
-                                               else if($operator == "lt")
-                                               {
-                                                       $operator_str = "<";
-                                               }
-                                               else if($operator == "gt")
-                                               {
-                                                       $operator_str = ">";
-                                               }
-                                               
-                                               $criteria_str = $column_name . 
" " . $operator_str . " " . $attrib_value;
-                                               
-                                               $criterias_array[] = array( 
$criteria_str );
-                                       }
+                                       $criterias_array['conditions'][] = 
$condition;
                                }
-                               
-                       $attrib_filter[] = 
"xmlexists('//type_lokale[contains(.,'',1,'')]' PASSING BY REF 
xml_representation)";
-                           
+                       }
+                   
                        $so_entity      = 
CreateObject('property.soentity',$entity_id,$cat_id);
-                       
-                       $entity = $so_entity->read(
-                               array(
-                               //'start' => $this->start,
-                               //'query' => $this->query,
-                               //'sort' => $this->sort,
-                               //'order' => $this->order,
-                               //'filter' => $this->filter,
-                               //'cat_id' => $this->cat_id,
-                               //'district_id' => $this->district_id, 
-                               //'part_of_town_id' => $this->part_of_town_id,
-                               
//'lookup'=>isset($data['lookup'])?$data['lookup']:'',
-                               'allrows' => true, 
-                               //'results' => $this->results,
-                               'entity_id' => $entity_id,
-                               'cat_id' => $cat_id,
-                               //'status'=>$this->status,
-                               
//'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),
-                               
//'end_date'=>$this->bocommon->date_to_timestamp($data['end_date']),
-                               //'dry_run' => true, 
-                               //'type'=>$data['type'], 
-                               //'location_code' => $this->location_code,
-                               //'criteria_id' => $this->criteria_id, 
-                               'attrib_filter' => $attrib_filter, 
-                               //'p_num' => $this->p_num
-                               )
+                       $allocation_suggestions = 
$so_entity->get_eav_list($criterias_array);
+
+                       $data = array
+                       (
+                               'requirement'                                   
        => $requirement,
+                               'activity'                                      
                        => $activity,
+                               'allocation_suggestions'        => 
$allocation_suggestions,
+                               'editable'                                      
                        => true
                        );
+               
+                       
self::render_template_xsl(array('allocation/allocation_suggestions'), $data);
+               }
 
-               print_r($entity);
+               public function save()
+               {
                        
-                       //$this->total_records = $this->so->total_records;
-                       //$this->uicols = $this->so->uicols;
+                       
$allocation->set_requirement_id(phpgw::get_var('requirement_id'));
+                       
$allocation->set_article_id(phpgw::get_var('article_id'));
+                       $allocation->set_type(phpgw::get_var('type'));
 
-                       //$user_columns = 
isset($GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]["{$this->type}_columns_{$this->entity_id}_{$this->cat_id}"])?$GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]["{$this->type}_columns_{$this->entity_id}_{$this->cat_id}"]:array();
-                       //$custom_cols = $this->get_column_list();
-                               
-
-                               
-                               $data = array
-                               (
-                                       'editable' => true,
-                               );
-
-                               if($activity_id > 0)
-                               {
-                                       $data['activity'] = $activity;
-                               }
-                       
-                               $data['requirement'] = $requirement;
-                       
-                               $data['requirement_value'] = $requirement_value;
-                               $data['attributes'] = $attributes;
-                               $data['elements'] = $list_items;
-
-                               
//self::render_template_xsl(array('allocation/allocation_item'), $data);
-                       }
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uirequirement_resource_allocation.view', 'id' 
=> $allocation_id));
                }
-
+               
                function convert_to_array($object_list)
                {
                        $converted_array = array();

Deleted: trunk/logistic/templates/base/allocation/allocation_item.xsl
===================================================================
--- trunk/logistic/templates/base/allocation/allocation_item.xsl        
2012-10-25 07:23:14 UTC (rev 10348)
+++ trunk/logistic/templates/base/allocation/allocation_item.xsl        
2012-10-25 09:04:42 UTC (rev 10349)
@@ -1,87 +0,0 @@
-<!-- $Id: activity_item.xsl 10096 2012-10-03 07:10:49Z vator $ -->
-<!-- item  -->
-
-<xsl:template match="data" xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')"/></xsl:variable>
-
-<xsl:call-template name="yui_phpgw_i18n"/>
-<div class="yui-navset yui-navset-top">
-       <div style="clear: both;margin-bottom: 0;overflow: hidden;padding: 
1em;" class="identifier-header">
-               <xsl:choose>
-                       <xsl:when test="activity/id != '' or activity/id != 0">
-                               <h1 style="float:left;">
-                                       <span>
-                                               <xsl:value-of 
select="php:function('lang', 'Add resources to activity')"/>: <xsl:value-of 
select="activity/name"/>
-                                       </span>
-                               </h1>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <h1 style="float:left;">
-                                       <xsl:value-of 
select="php:function('lang', 'Add requirement')" />
-                               </h1>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </div>
-
-       <div class="yui-content" style="padding: 20px;">
-               <div id="details">
-                       <form action="#" method="post">
-                               <input type="hidden" name="id" value = 
"{activity/id}" />
-
-                               <dl class="proplist-col">
-                                       <dt>
-                                               <label 
for="start_date">Startdato</label>
-                                       </dt>
-                                       <dd>
-                                               <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/start_date))"/></span>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="end_date">Sluttdato</label>
-                                       </dt>
-                                       <dd>
-                                               <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/end_date))"/></span>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="no_of_items">Antall</label>
-                                       </dt>
-                                       <dd>
-                                               <span><xsl:value-of 
select="requirement/no_of_items" /></span>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="bim_item">ELEMENTER</label>
-                                       </dt>
-                                       <dd>
-                                               <xsl:for-each select="elements">
-                                                       <input type="checkbox" 
value="{id}" /> <xsl:value-of select="location_code" /> - <xsl:value-of 
select="type" /><br/>
-                                               </xsl:for-each>
-                                       </dd>
-                               </dl>
-
-                               <div class="form-buttons">
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="save_activity" value="{$lang_save}" title = "{$lang_save}" />
-                                                       <input type="submit" 
name="cancel_activity" value="{$lang_cancel}" title = "{$lang_cancel}" />
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="edit_activity" value="{$lang_edit}" title = "{$lang_edit}" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </div>
-                       </form>
-               </div>
-       </div>
-</div>
-</xsl:template>
-
-<xsl:template match="options">
-       <option value="{id}">
-               <xsl:if test="selected">
-                       <xsl:attribute name="selected" value="selected" />
-               </xsl:if>
-               <xsl:value-of disable-output-escaping="yes" select="name"/>
-       </option>
-</xsl:template>

Copied: trunk/logistic/templates/base/allocation/allocation_suggestions.xsl 
(from rev 10285, trunk/logistic/templates/base/allocation/allocation_item.xsl)
===================================================================
--- trunk/logistic/templates/base/allocation/allocation_suggestions.xsl         
                (rev 0)
+++ trunk/logistic/templates/base/allocation/allocation_suggestions.xsl 
2012-10-25 09:04:42 UTC (rev 10349)
@@ -0,0 +1,72 @@
+<!-- $Id: activity_item.xsl 10096 2012-10-03 07:10:49Z vator $ -->
+<!-- item  -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')"/></xsl:variable>
+
+<xsl:call-template name="yui_phpgw_i18n"/>
+<div id="resource-allocation" class="yui-navset yui-navset-top">
+       <h1>
+               <xsl:value-of select="php:function('lang', 'Add resources to 
activity')"/>: <xsl:value-of select="activity/name"/>
+       </h1>
+       
+       <div class="content-wrp">
+               
+               <div id="requirement-wrp">
+               
+               <h2>Krav til aktiviteten</h2>
+               
+                       <ul>
+                               <li>
+                                       <label 
for="start_date">Startdato</label><span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/start_date))"/></span>
+                               </li>
+                               <li>
+                                       <label for="end_date">Sluttdato</label>
+                                       <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/end_date))"/></span>
+                               </li>
+                               <li>
+                                       <label for="no_of_items">Antall</label>
+                                       <span><xsl:value-of 
select="requirement/no_of_items" /></span>
+                               </li>
+                               </ul>
+                       </div>
+                        
+                       <hr style="border-color: #9FB9D7;margin: 0 15px;" />
+                       
+                       <xsl:variable name="action_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:logistic.uirequirement_resource_allocation.save')" />
+                       </xsl:variable>
+                       <form action="{$action_url}" method="post">
+                               <input type="hidden" name="id" value = 
"{requirement/id}" />
+
+                               <div id="resource-list">
+                                       <div class="resource heading">
+                                                       <span class="desc">Kort 
beskrivelse</span>
+                                                       <span 
class="loc_id">Lokasjons id</span>
+                                                       <span 
class="type">Type</span>
+                                                       <span 
class="loc_code">Lokasjons kode</span>
+                                       </div>
+                                       <xsl:for-each 
select="allocation_suggestions">
+                                               
+                                               <div>                           
+                                                       <xsl:choose>
+                                                       <xsl:when 
test="(position() mod 2) != 1">
+                                                       <xsl:attribute 
name="class">resource odd</xsl:attribute>
+                                                   </xsl:when>
+                                                   <xsl:otherwise>
+                                                       <xsl:attribute 
name="class">resource even</xsl:attribute>
+                                                   </xsl:otherwise>
+                                                 </xsl:choose>
+                                               
+                                                       <input type="checkbox" 
value="{id}" name="chosen_resources[]" />
+                                                       <span 
class="desc"><xsl:value-of select="short_description" /></span>
+                                                       <span 
class="loc_id"><xsl:value-of select="location_id" /></span>
+                                                       <span 
class="type"><xsl:value-of select="type_lokale" /></span>
+                                                       <span 
class="loc_code"><xsl:value-of select="location_code" /></span>
+                                               </div>
+                                       </xsl:for-each>
+                               </div>                  
+                       </form>
+       </div>
+</div>
+</xsl:template>
\ No newline at end of file


Property changes on: 
trunk/logistic/templates/base/allocation/allocation_suggestions.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/logistic/templates/base/css/base.css
===================================================================
--- trunk/logistic/templates/base/css/base.css  2012-10-25 07:23:14 UTC (rev 
10348)
+++ trunk/logistic/templates/base/css/base.css  2012-10-25 09:04:42 UTC (rev 
10349)
@@ -2265,4 +2265,59 @@
 
 .yui-navset .content-wrp {
        margin-top: 0;
+}
+
+
+/* REQUIOREMENT RESOUCRCE ALLOCATION */
+
+#requirement-wrp {
+  font-size: 15px;
+  padding: 20px;
+}
+
+#requirement-wrp label{
+  font-size: 16px;
+    
+}
+
+#requirement-wrp h2{
+       margin:0 0 10px;
+}
+
+#requirement-wrp ul li{
+       margin:0 0 10px;
+}
+
+#resource-allocation form{
+       margin: 20px;
+       border: 1px solid #B0D9FF;
+}
+
+#resource-list .resource{
+       padding: 5px 0;
+}
+
+#resource-list .resource.odd{
+       background: #fff;
+}
+
+#resource-list .resource span, #resource-list .resource input {
+       vertical-align: middle;
+}
+
+#resource-list .resource span {
+       display: inline-block;
+       width: 200px;
+}
+
+#resource-list .resource span.desc {
+       font-weight:bold;
+       width: 300px;
+}
+
+#resource-list .resource.heading {
+    background: none repeat scroll 0 0 #B0D9FF;
+    color: #092845;
+    font-weight: bold;
+    padding: 5px 8px;
 }
\ No newline at end of file




reply via email to

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