[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8549]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8549] |
Date: |
Tue, 10 Jan 2012 08:19:29 +0000 |
Revision: 8549
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8549
Author: vator
Date: 2012-01-10 08:19:28 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.socheck_item.inc.php
trunk/controller/inc/class.uicase.inc.php
trunk/controller/inc/model/class.check_item.inc.php
Added Paths:
-----------
trunk/controller/templates/base/case/create_case_message.xsl
trunk/controller/templates/base/case/view_case_message.xsl
Removed Paths:
-------------
trunk/controller/templates/base/case/create_case.xsl
trunk/controller/templates/base/case/view_case.xsl
Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php 2012-01-10 07:49:50 UTC
(rev 8548)
+++ trunk/controller/inc/class.socheck_item.inc.php 2012-01-10 08:19:28 UTC
(rev 8549)
@@ -212,85 +212,69 @@
return $check_items_array;
}
- public function get_check_items_and_cases($check_list_id){
- $sql = "SELECT ci.id as ci_id, ci.status,
control_item_id, ci.comment, ci.measurement, check_list_id, cic.* ";
+ public function get_check_items_and_cases($check_list_id,
$returnType = "object"){
+ $sql = "SELECT ci.id as ci_id, ci.status,
control_item_id, ci.comment, ci.measurement, check_list_id, cic.id as cic_id,
cic.* ";
$sql .= "FROM controller_check_item ci ";
$sql .= "LEFT JOIN controller_check_item_case as cic ON
ci.id = cic.check_item_id ";
$sql .= "WHERE ci.check_list_id = $check_list_id ";
$this->db->query($sql);
+ $check_item_id = 0;
+ $check_item = null;
while ($this->db->next_record()) {
-
- if( $this->db->f('cl_id', true) !=
$check_list_id ){
+
+ if( $this->db->f('ci_id', true) !=
$check_item_id ){
- if($check_list_id != 0){
-
$check_list->set_check_item_array($check_items_array);
- $check_list_array[] =
$check_list->toArray();
+ if($check_item_id != 0){
+
$check_item->set_cases_array($cases_array);
+
+ if($returnType == "array")
+ $check_items_array[] =
$check_item->toArray();
+ else
+ $check_items_array[] =
$check_item;
}
-
+
$check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
$check_item->set_status($this->unmarshal($this->db->f('status', true), 'bool'));
$check_item->set_comment($this->unmarshal($this->db->f('comment', true),
'string'));
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id',
true), 'int'));
$check_item->set_measurement($this->unmarshal($this->db->f('measurement',
true), 'int'));
-
- $check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'bool'));
-
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
-
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
-
- $check_items_array = array();
+
+ $cases_array = array();
}
- $check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
-
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true),
'bool'));
-
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true),
'string'));
-
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id',
true), 'int'));
-
- $check_items_array[] = $check_item->toArray();
-
- $check_list_id = $check_list->get_id();
- }
+ $case = new
controller_check_item_case($this->unmarshal($this->db->f('cic_id', true),
'int'));
+
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id', true),
'int'));
+
$case->set_location_id($this->unmarshal($this->db->f('location_id', true),
'int'));
+
$case->set_location_item_id($this->unmarshal($this->db->f('location_item_id',
true), 'int'));
+
$case->set_descr($this->unmarshal($this->db->f('descr', true), 'string'));
+
$case->set_user_id($this->unmarshal($this->db->f('user_id', true), 'int'));
+
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true),
'int'));
+
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true),
'int'));
+
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true),
'int'));
- if($check_list != null){
-
$check_list->set_check_item_array($check_items_array);
- $check_list_array[] = $check_list->toArray();
-
- return $check_list_array;
- }else {
- return null;
+ if($returnType == "array")
+ $cases_array[] = $case->toArray();
+ else
+ $cases_array[] = $case;
+
+ $check_item_id = $check_item->get_id();
}
-
-
-
-
-
- while ($this->db->next_record()) {
- $check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
-
$check_item->set_status($this->unmarshal($this->db->f('status', true), 'bool'));
-
$check_item->set_comment($this->unmarshal($this->db->f('comment', true),
'string'));
-
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id',
true), 'int'));
-
$check_item->set_measurement($this->unmarshal($this->db->f('measurement',
true), 'int'));
+ if($check_item != null){
+ $check_item->set_cases_array($cases_array);
- $case = new
controller_check_item_case($this->unmarshal($this->db->f('coi_id', true),
'int'));
- $control_item->set_title($this->db->f('title',
true), 'string');
-
$control_item->set_required($this->db->f('required', true), 'string');
-
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
-
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
-
$control_item->set_control_group_id($this->db->f('control_group_id', true),
'string');
- $control_item->set_type($this->db->f('type',
true), 'string');
+ if($returnType == "array")
+ $check_items_array[] =
$check_item->toArray();
+ else
+ $check_items_array[] = $check_item;
-
$check_item->set_control_item($control_item->toArray());
-
- $check_items_array[] = $check_item->toArray();
+ return $check_items_array;
+ }else {
+ return null;
}
-
- return $check_items_array;
}
public function get_check_items_by_message($message_ticket_id){
Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php 2012-01-10 07:49:50 UTC (rev
8548)
+++ trunk/controller/inc/class.uicase.inc.php 2012-01-10 08:19:28 UTC (rev
8549)
@@ -91,8 +91,8 @@
function create_case_message(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_items_and_cases =
$this->so_check_list->get_check_items_by_check_list($check_list_id);
-
+ $check_items_and_cases =
$this->so_check_item->get_check_items_and_cases($check_list_id, "array");
+
$control_id =
$check_list_with_check_items["control_id"];
$control = $this->so_control->get_single( $control_id );
@@ -116,7 +116,7 @@
(
'categories' => $categories,
'control_array' =>
$control->toArray(),
- 'check_list' =>
$check_list_with_check_items,
+ 'check_items_and_cases' =>
$check_items_and_cases,
'buildings_array' =>
$buildings_array,
'date_format' => $date_format
);
Modified: trunk/controller/inc/model/class.check_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item.inc.php 2012-01-10 07:49:50 UTC
(rev 8548)
+++ trunk/controller/inc/model/class.check_item.inc.php 2012-01-10 08:19:28 UTC
(rev 8549)
@@ -44,6 +44,7 @@
// Objects
protected $control_item;
+ protected $cases_array = array();
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -114,6 +115,13 @@
}
public function get_control_item() { return
$this->control_item; }
+
+ public function set_cases_array($cases_array)
+ {
+ $this->cases_array = $cases_array;
+ }
+
+ public function get_cases_array() { return $this->cases_array; }
/**
Deleted: trunk/controller/templates/base/case/create_case.xsl
===================================================================
--- trunk/controller/templates/base/case/create_case.xsl 2012-01-10
07:49:50 UTC (rev 8548)
+++ trunk/controller/templates/base/case/create_case.xsl 2012-01-10
08:19:28 UTC (rev 8549)
@@ -1,103 +0,0 @@
-<!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
-<xsl:template match="data" name="view_check_list"
xmlns:php="http://php.net/xsl">
-<xsl:variable name="date_format">d/m-Y</xsl:variable>
-
-<div id="main_content">
-
- <h1>Registrer avviksmelding</h1>
-
- <h3 class="box_header">Meldingen gjelder</h3>
- <div id="case_details">
- <h3 class="first">Tittel på kontroll: <xsl:value-of
select="control_array/title"/></h3>
- <xsl:choose>
- <xsl:when test="check_list/completed_date != 0">
- <h3>Kontroll ble utført
dato:<xsl:value-of select="php:function('date', $date_format,
number(check_list/completed_date))"/></h3>
- </xsl:when>
- <xsl:otherwise>
- <h3>Kontroll ble utført dato: Ikke
registrert utført</h3>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="buildings_array/child::node()">
- <select id="building_id"
name="building_id">
- <option value="0">
- Velg bygning
- </option>
- <xsl:for-each
select="buildings_array">
- <option
value="{id}">
-
<xsl:value-of disable-output-escaping="yes" select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </xsl:when>
- <xsl:otherwise>
- <h3 class="last">Bygg: <xsl:value-of
select="building_array/loc1_name"/></h3>
- </xsl:otherwise>
- </xsl:choose>
-
- </div>
-
- <h3 class="box_header">Detaljer for meldingen</h3>
- <fieldset id="case_details">
- <xsl:choose>
- <xsl:when
test="check_list/check_item_array/child::node()">
-
- <form class="frm_save_case"
action="index.php?menuaction=controller.uicase.save_case" method="post">
- <input>
- <xsl:attribute
name="name">check_list_id</xsl:attribute>
- <xsl:attribute
name="type">hidden</xsl:attribute>
- <xsl:attribute name="value">
- <xsl:value-of select="check_list/id"/>
- </xsl:attribute>
- </input>
- <div>
- <label>Tittel på melding</label>
- <input name="message_title"
type="text" />
- </div>
-
- <div>
- <label>Kategori</label>
- <select name="message_cat_id">
- <option value="0">Velg
kategori</option>
- <xsl:for-each
select="categories/cat_list">
- <xsl:variable
name="cat_id"><xsl:value-of select="./cat_id"/></xsl:variable>
- <option
value="{$cat_id}">
-
<xsl:value-of select="./name"/>
- </option>
- </xsl:for-each>
- </select>
- </div>
-
- <h3 class="check_item_details">Velg
sjekkpunkter som skal være med i avviksmelding</h3>
- <ul class="check_items">
- <xsl:for-each
select="check_list/check_item_array">
- <li>
- <xsl:variable
name="check_item_id"><xsl:value-of select="id" /></xsl:variable>
- <h5><input
type="checkbox" name="check_item_ids[]" value="{$check_item_id}"
/><span><xsl:value-of select="control_item/title"/></span></h5>
- </li>
- </xsl:for-each>
- </ul>
-
- <div class="form-buttons">
- <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
- <input class="btn focus"
type="submit" name="save_control" value="Registrer avviksmelding"
title="{$lang_save}" />
- </div>
- </form>
- </xsl:when>
- <xsl:otherwise>
- Ingen registrerte avvik
- </xsl:otherwise>
- </xsl:choose>
- </fieldset>
-
- <a class="btn">
- <xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicheck_list_for_location.edit_check_list_for_location</xsl:text>
- <xsl:text>&check_list_id=</xsl:text>
- <xsl:value-of select="check_list/id"/>
- </xsl:attribute>
- Vis sjekkliste
- </a>
-
-</div>
-</xsl:template>
Copied: trunk/controller/templates/base/case/create_case_message.xsl (from rev
8548, trunk/controller/templates/base/case/create_case.xsl)
===================================================================
--- trunk/controller/templates/base/case/create_case_message.xsl
(rev 0)
+++ trunk/controller/templates/base/case/create_case_message.xsl
2012-01-10 08:19:28 UTC (rev 8549)
@@ -0,0 +1,103 @@
+<!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
+<xsl:template match="data" name="view_check_list"
xmlns:php="http://php.net/xsl">
+<xsl:variable name="date_format">d/m-Y</xsl:variable>
+
+<div id="main_content">
+
+ <h1>Registrer avviksmelding</h1>
+
+ <h3 class="box_header">Meldingen gjelder</h3>
+ <div id="case_details">
+ <h3 class="first">Tittel på kontroll: <xsl:value-of
select="control_array/title"/></h3>
+ <xsl:choose>
+ <xsl:when test="check_list/completed_date != 0">
+ <h3>Kontroll ble utført
dato:<xsl:value-of select="php:function('date', $date_format,
number(check_list/completed_date))"/></h3>
+ </xsl:when>
+ <xsl:otherwise>
+ <h3>Kontroll ble utført dato: Ikke
registrert utført</h3>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="buildings_array/child::node()">
+ <select id="building_id"
name="building_id">
+ <option value="0">
+ Velg bygning
+ </option>
+ <xsl:for-each
select="buildings_array">
+ <option
value="{id}">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <h3 class="last">Bygg: <xsl:value-of
select="building_array/loc1_name"/></h3>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </div>
+
+ <h3 class="box_header">Detaljer for meldingen</h3>
+ <fieldset id="case_details">
+ <xsl:choose>
+ <xsl:when
test="check_list/check_item_array/child::node()">
+
+ <form class="frm_save_case"
action="index.php?menuaction=controller.uicase.save_case" method="post">
+ <input>
+ <xsl:attribute
name="name">check_list_id</xsl:attribute>
+ <xsl:attribute
name="type">hidden</xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="check_list/id"/>
+ </xsl:attribute>
+ </input>
+ <div>
+ <label>Tittel på melding</label>
+ <input name="message_title"
type="text" />
+ </div>
+
+ <div>
+ <label>Kategori</label>
+ <select name="message_cat_id">
+ <option value="0">Velg
kategori</option>
+ <xsl:for-each
select="categories/cat_list">
+ <xsl:variable
name="cat_id"><xsl:value-of select="./cat_id"/></xsl:variable>
+ <option
value="{$cat_id}">
+
<xsl:value-of select="./name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </div>
+
+ <h3 class="check_item_details">Velg
sjekkpunkter som skal være med i avviksmelding</h3>
+ <ul class="check_items">
+ <xsl:for-each
select="check_list/check_item_array">
+ <li>
+ <xsl:variable
name="check_item_id"><xsl:value-of select="id" /></xsl:variable>
+ <h5><input
type="checkbox" name="check_item_ids[]" value="{$check_item_id}"
/><span><xsl:value-of select="control_item/title"/></span></h5>
+ </li>
+ </xsl:for-each>
+ </ul>
+
+ <div class="form-buttons">
+ <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
+ <input class="btn focus"
type="submit" name="save_control" value="Registrer avviksmelding"
title="{$lang_save}" />
+ </div>
+ </form>
+ </xsl:when>
+ <xsl:otherwise>
+ Ingen registrerte avvik
+ </xsl:otherwise>
+ </xsl:choose>
+ </fieldset>
+
+ <a class="btn">
+ <xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicheck_list_for_location.edit_check_list_for_location</xsl:text>
+ <xsl:text>&check_list_id=</xsl:text>
+ <xsl:value-of select="check_list/id"/>
+ </xsl:attribute>
+ Vis sjekkliste
+ </a>
+
+</div>
+</xsl:template>
Property changes on:
trunk/controller/templates/base/case/create_case_message.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/controller/templates/base/case/view_case.xsl
===================================================================
--- trunk/controller/templates/base/case/view_case.xsl 2012-01-10 07:49:50 UTC
(rev 8548)
+++ trunk/controller/templates/base/case/view_case.xsl 2012-01-10 08:19:28 UTC
(rev 8549)
@@ -1,65 +0,0 @@
-<!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
-<xsl:template match="data" name="view_check_list"
xmlns:php="http://php.net/xsl">
-<xsl:variable name="date_format">d/m-Y</xsl:variable>
-
-<div id="main_content">
-
- <h1>Avviksmelding registrert</h1>
-
-
- <h3 class="box_header" href="#">Meldingen gjaldt</h3>
- <div id="case_details">
- <h3>Bygg: <xsl:value-of
select="location_array/loc1_name"/></h3>
- <h3>Tittel på kontroll: <xsl:value-of
select="control_array/title"/></h3>
- <xsl:choose>
- <xsl:when test="check_list/completed_date != 0">
- <h3>Kontroll ble utført dato:
<xsl:value-of select="php:function('date', $date_format,
number(check_list/completed_date))"/></h3>
- </xsl:when>
- <xsl:otherwise>
- <h3>Kontroll ble utført dato: Ikke
registrert utført</h3>
- </xsl:otherwise>
- </xsl:choose>
- </div>
-
- <h3 class="box_header" href="#">Detaljer for melding</h3>
- <div id="case_details">
- <div>
- <label>Tittel på melding</label>
- <xsl:value-of select="message_ticket/subject"/>
- </div>
-
- <div>
- <label>Kategori</label>
- <span><xsl:value-of select="category"/></span>
- </div>
-
-
- <h3 class="check_item_details">Avviksmeldingen omfattet
følgende punkter</h3>
- <ul class="check_items">
- <xsl:for-each
select="registered_message_check_items">
- <li>
- <xsl:variable
name="check_item_id"><xsl:value-of select="id" /></xsl:variable>
- <h5><xsl:value-of
select="control_item/title"/></h5>
- </li>
- </xsl:for-each>
- </ul>
- </div>
-
- <a class="btn">
- <xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicase.create_case</xsl:text>
- <xsl:text>&check_list_id=</xsl:text>
- <xsl:value-of select="check_list/id"/>
- </xsl:attribute>
- Registrer ny melding
- </a>
- <a class="btn">
- <xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicheck_list_for_location.edit_check_list_for_location</xsl:text>
- <xsl:text>&check_list_id=</xsl:text>
- <xsl:value-of select="check_list/id"/>
- </xsl:attribute>
- Endre sjekkliste
- </a>
-</div>
-</xsl:template>
Copied: trunk/controller/templates/base/case/view_case_message.xsl (from rev
8548, trunk/controller/templates/base/case/view_case.xsl)
===================================================================
--- trunk/controller/templates/base/case/view_case_message.xsl
(rev 0)
+++ trunk/controller/templates/base/case/view_case_message.xsl 2012-01-10
08:19:28 UTC (rev 8549)
@@ -0,0 +1,65 @@
+<!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
+<xsl:template match="data" name="view_check_list"
xmlns:php="http://php.net/xsl">
+<xsl:variable name="date_format">d/m-Y</xsl:variable>
+
+<div id="main_content">
+
+ <h1>Avviksmelding registrert</h1>
+
+
+ <h3 class="box_header" href="#">Meldingen gjaldt</h3>
+ <div id="case_details">
+ <h3>Bygg: <xsl:value-of
select="location_array/loc1_name"/></h3>
+ <h3>Tittel på kontroll: <xsl:value-of
select="control_array/title"/></h3>
+ <xsl:choose>
+ <xsl:when test="check_list/completed_date != 0">
+ <h3>Kontroll ble utført dato:
<xsl:value-of select="php:function('date', $date_format,
number(check_list/completed_date))"/></h3>
+ </xsl:when>
+ <xsl:otherwise>
+ <h3>Kontroll ble utført dato: Ikke
registrert utført</h3>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+
+ <h3 class="box_header" href="#">Detaljer for melding</h3>
+ <div id="case_details">
+ <div>
+ <label>Tittel på melding</label>
+ <xsl:value-of select="message_ticket/subject"/>
+ </div>
+
+ <div>
+ <label>Kategori</label>
+ <span><xsl:value-of select="category"/></span>
+ </div>
+
+
+ <h3 class="check_item_details">Avviksmeldingen omfattet
følgende punkter</h3>
+ <ul class="check_items">
+ <xsl:for-each
select="registered_message_check_items">
+ <li>
+ <xsl:variable
name="check_item_id"><xsl:value-of select="id" /></xsl:variable>
+ <h5><xsl:value-of
select="control_item/title"/></h5>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </div>
+
+ <a class="btn">
+ <xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicase.create_case</xsl:text>
+ <xsl:text>&check_list_id=</xsl:text>
+ <xsl:value-of select="check_list/id"/>
+ </xsl:attribute>
+ Registrer ny melding
+ </a>
+ <a class="btn">
+ <xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicheck_list_for_location.edit_check_list_for_location</xsl:text>
+ <xsl:text>&check_list_id=</xsl:text>
+ <xsl:value-of select="check_list/id"/>
+ </xsl:attribute>
+ Endre sjekkliste
+ </a>
+</div>
+</xsl:template>
Property changes on: trunk/controller/templates/base/case/view_case_message.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8549],
Torstein <=