[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10566] property: More on condition survey
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10566] property: More on condition survey |
Date: |
Mon, 03 Dec 2012 20:30:26 +0000 |
Revision: 10566
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10566
Author: sigurdne
Date: 2012-12-03 20:30:25 +0000 (Mon, 03 Dec 2012)
Log Message:
-----------
property: More on condition survey
Modified Paths:
--------------
trunk/property/inc/class.uicondition_survey.inc.php
trunk/property/templates/base/condition_survey.xsl
trunk/property/templates/base/condition_survey_import.xsl
Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-03 15:05:23 UTC
(rev 10565)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-03 20:30:25 UTC
(rev 10566)
@@ -585,9 +585,12 @@
throw new
Exception('uicondition_survey::_handle_import() - missing id');
}
- $step = phpgw::get_var('step', 'REQUEST', 'int');
- $sheet_id = phpgw::get_var('sheet_id', 'REQUEST',
'int');
+ $step = phpgw::get_var('step',
'REQUEST', 'int');
+ $sheet_id = phpgw::get_var('sheet_id',
'REQUEST', 'int');
+ $sheet_id = $sheet_id ? $sheet_id :
phpgw::get_var('selected_sheet_id', 'REQUEST', 'int');
+ $start_line = phpgw::get_var('start_line',
'REQUEST', 'int', 1);
+
if(!$cached_file =
phpgwapi_cache::session_get('property', 'condition_survey_import_file'))
{
$file = $_FILES['import_file']['tmp_name'];
@@ -597,7 +600,7 @@
phpgwapi_cache::session_set('property',
'condition_survey_import_file',$cached_file);
}
-
+//_debug_array($_POST);die();
phpgw::import_class('phpgwapi.phpexcel');
$objPHPExcel = PHPExcel_IOFactory::load($cached_file);
@@ -626,24 +629,75 @@
switch ($step)
{
case 0:
+ $active_tab = 'step_1';
$tabs['step_1'] = array('label' =>
lang('step_1'), 'link' => '#step_1');
- $active_tab = 'step_1';
$tabs['step_2'] = array('label' =>
lang('step_2'), 'link' => null);
$tabs['step_3'] = array('label' =>
lang('step_3'), 'link' => null);
break;
case 1:
+ $active_tab = 'step_2';
$tabs['step_1'] = array('label' =>
lang('step_1'), 'link' => null);
- $active_tab = 'step_2';
$tabs['step_2'] = array('label' =>
lang('step_2'), 'link' => '#step_2');
$tabs['step_3'] = array('label' =>
lang('step_3'), 'link' => null);
break;
+ case 2:
+ $active_tab = 'step_3';
+ $tabs['step_1'] = array('label' =>
lang('step_1'), 'link' => null);
+ $tabs['step_2'] = array('label' =>
lang('step_2'), 'link' => null);
+ $tabs['step_3'] = array('label' =>
lang('step_3'), 'link' => '#step_3');
+ break;
}
+
+//-----------
+
+
+ $objPHPExcel->setActiveSheetIndex((int)$sheet_id);
+
+ $data =
$objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+ $html_table = '<table border="1">';
+ if($data && $step == 1)
+ {
+ $i = 0;
+ $html_table .= "<tr><th align = 'center'>".
lang('start'). "</th><th align='center'>" . implode("</th><th align='center'>",
array_keys($data[1])) . '</th></tr>';
+ foreach($data as $row_key => $row)
+ {
+ if($i>20)
+ {
+ break;
+ }
+
+ $_checked = '';
+ if($start_line == $row_key)
+ {
+ $_checked = 'checked="checked"';
+ }
+
+ $_radio = "<input id=\"start_line\"
type =\"radio\" {$_checked} name=\"start_line\" value=\"{$row_key}\">";
+
+ $html_table .=
"<tr><td>{$_radio}</td><td>" . implode('</td><td>', array_values($row)) .
'</td></tr>';
+ $i++;
+ }
+ }
+ else if($data && $step == 2)
+ {
+ foreach($data[$start_line] as $_column =>
$_value)
+ {
+ $_checkbox = "<input id=\"start_line\"
type =\"checkbox\" {$_checked} name=\"column\" value=\"{$_column}\">";
+ $html_table .=
"<tr><td>{$_value}</td><td>{$_checkbox}</td><tr>";
+ }
+ }
+
+ $html_table .= '</table>';
+
+
$data = array
(
'survey'
=> array('id'=>$id),
'step'
=> $step +1,
+ 'sheet_id'
=> $sheet_id,
+ 'html_table'
=> $html_table,
'sheets'
=> array('options' => $sheets),
'tabs'
=> phpgwapi_yui::tabview_generate($tabs, $active_tab),
);
@@ -653,14 +707,9 @@
self::render_template_xsl(array('condition_survey_import'), $data);
-//-----------
+//_debug_array($html_table);
- $objPHPExcel->setActiveSheetIndex((int)$sheet_id);
-
- $data =
$objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
-_debug_array($data);
-
return;
Modified: trunk/property/templates/base/condition_survey.xsl
===================================================================
--- trunk/property/templates/base/condition_survey.xsl 2012-12-03 15:05:23 UTC
(rev 10565)
+++ trunk/property/templates/base/condition_survey.xsl 2012-12-03 20:30:25 UTC
(rev 10566)
@@ -5,7 +5,7 @@
<xsl:call-template name="yui_phpgw_i18n"/>
<div class="yui-navset" id="survey_edit_tabview">
-
+
<h1>
<xsl:value-of select="php:function('lang', 'condition
survey')" />
</h1>
@@ -28,7 +28,7 @@
<xsl:value-of disable-output-escaping="yes"
select="tabs"/>
<div class="yui-content">
<div id="generic" class="content-wrp">
-
+
<dl class="proplist-col">
<xsl:choose>
<xsl:when test="survey/id!=''">
@@ -54,7 +54,7 @@
</xsl:choose>
</xsl:when>
</xsl:choose>
-
+
<dt>
<label for="name"><xsl:value-of
select="php:function('lang', 'name')" /></label>
</dt>
@@ -71,8 +71,8 @@
</xsl:otherwise>
</xsl:choose>
</dd>
-
-
+
+
<dt>
<label for="name"><xsl:value-of
select="php:function('lang', 'description')" /></label>
</dt>
@@ -90,8 +90,8 @@
</xsl:otherwise>
</xsl:choose>
</dd>
-
-
+
+
<dt>
<label
for="category"><xsl:value-of select="php:function('lang', 'category')"
/></label>
</dt>
@@ -105,14 +105,14 @@
</select>
</xsl:when>
<xsl:otherwise>
- <select
id="cat_id" disabled="disabled">
-
<xsl:apply-templates select="categories/options"/>
- </select>
- </xsl:otherwise>
+ <xsl:for-each
select="categories/options">
+ <xsl:if
test="selected = 'selected' or selected = 1">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+
</xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
</xsl:choose>
</dd>
-
-
<dt>
<label
for="category"><xsl:value-of select="php:function('lang', 'date')" /></label>
</dt>
@@ -128,8 +128,7 @@
</xsl:otherwise>
</xsl:choose>
</dd>
-
-
+
<dt>
<label
for="status"><xsl:value-of select="php:function('lang', 'status')" /></label>
</dt>
@@ -143,15 +142,15 @@
</select>
</xsl:when>
<xsl:otherwise>
- <select
id="status_id" disabled="disabled">
-
<xsl:apply-templates select="status_list/options"/>
- </select>
+ <xsl:for-each
select="status_list/options">
+ <xsl:if
test="selected = 'selected' or selected = 1">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+
</xsl:if>
+ </xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</dd>
-
-
<dt>
<label
for="coordinator"><xsl:value-of select="php:function('lang', 'coordinator')"
/></label>
</dt>
@@ -172,9 +171,9 @@
</xsl:choose>
</dd>
-
-
+
+
<dt>
<label
for="vendor"><xsl:value-of select="php:function('lang', 'vendor')" /></label>
</dt>
@@ -195,8 +194,8 @@
</xsl:choose>
</dd>
-
+
</dl>
</div>
@@ -212,14 +211,14 @@
<xsl:call-template name="datasource-definition"
/>
<dl class="proplist-col">
-
+
<dt>
<label><xsl:value-of
select="php:function('lang', 'files')"/></label>
</dt>
<dd>
- <div
style="clear:both;" id="datatable-container_0"></div>
+ <div
style="clear:both;" id="datatable-container_0"></div>
</dd>
-
+
<xsl:choose>
<xsl:when test="editable = 1">
<xsl:call-template
name="file_upload"/>
@@ -231,7 +230,7 @@
<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>
@@ -242,7 +241,7 @@
</xsl:attribute>
</input>
</dd>
-
+
</dl>
</div>
</xsl:when>
@@ -250,8 +249,8 @@
</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>
@@ -269,8 +268,8 @@
</xsl:otherwise>
</xsl:choose>
</div>
-
+
</dl>
</form>
</div>
Modified: trunk/property/templates/base/condition_survey_import.xsl
===================================================================
--- trunk/property/templates/base/condition_survey_import.xsl 2012-12-03
15:05:23 UTC (rev 10565)
+++ trunk/property/templates/base/condition_survey_import.xsl 2012-12-03
20:30:25 UTC (rev 10566)
@@ -34,6 +34,7 @@
<xsl:value-of select="survey/id"/>
<input
type="hidden" name="id" value="{survey/id}"/>
<input
type="hidden" name="step" value="{step}"/>
+ <input
type="hidden" name="selected_sheet_id" value="{sheet_id}"/>
</dd>
</xsl:when>
</xsl:choose>
@@ -142,18 +143,29 @@
<div id="step_2" class="content-wrp">
<dl class="proplist-col">
<dt>
- <label for="status"><xsl:value-of
select="php:function('lang', 'sheets')" /></label>
+ <label for="status"><xsl:value-of
select="php:function('lang', 'table')" /></label>
</dt>
<dd>
- <select id="sheet_id" name="sheet_id">
- <xsl:apply-templates select="sheets/options"/>
- </select>
+ <xsl:value-of disable-output-escaping="yes"
select="html_table"/>
</dd>
</dl>
</div>
</xsl:template>
+<xsl:template name="import_step_3" xmlns:php="http://php.net/xsl">
+ <div id="step_2" class="content-wrp">
+ <dl class="proplist-col">
+ <dt>
+ <label for="status"><xsl:value-of
select="php:function('lang', 'table')" /></label>
+ </dt>
+ <dd>
+ <xsl:value-of disable-output-escaping="yes"
select="html_table"/>
+ </dd>
+ </dl>
+ </div>
+</xsl:template>
+
<xsl:template match="options">
<option value="{id}">
<xsl:if test="selected = 'selected' or selected = 1">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10566] property: More on condition survey,
Sigurd Nes <=