[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14031] booking: statistics
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14031] booking: statistics |
Date: |
Mon, 28 Sep 2015 11:56:58 +0000 |
Revision: 14031
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14031
Author: sigurdne
Date: 2015-09-28 11:56:58 +0000 (Mon, 28 Sep 2015)
Log Message:
-----------
booking: statistics
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.boactivity.inc.php
branches/dev-syncromind/booking/inc/class.soactivity.inc.php
branches/dev-syncromind/booking/inc/class.uireports.inc.php
branches/dev-syncromind/booking/js/booking/report.js
branches/dev-syncromind/booking/templates/base/report_new.xsl
branches/dev-syncromind/controller/templates/base/component.xsl
Modified: branches/dev-syncromind/booking/inc/class.boactivity.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.boactivity.inc.php
2015-09-26 15:50:13 UTC (rev 14030)
+++ branches/dev-syncromind/booking/inc/class.boactivity.inc.php
2015-09-28 11:56:58 UTC (rev 14031)
@@ -55,4 +55,10 @@
{
return $this->activity_so->read_single($id);
}
+
+ public function get_path($id)
+ {
+ return $this->so->get_path($id);
+ }
+
}
Modified: branches/dev-syncromind/booking/inc/class.soactivity.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soactivity.inc.php
2015-09-26 15:50:13 UTC (rev 14030)
+++ branches/dev-syncromind/booking/inc/class.soactivity.inc.php
2015-09-28 11:56:58 UTC (rev 14031)
@@ -35,4 +35,25 @@
return $errors;
}
+ public function get_path($id)
+ {
+
+ $sql = "SELECT name, parent_id FROM bb_activity WHERE
id =" . (int) $id;
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->db->next_record();
+
+ $parent_id = $this->db->f('parent_id');
+
+ $name = $this->db->f('name', true);
+
+ $path = array(array('id' => $id,'name' => $name));
+
+ if($parent_id)
+ {
+ $path =
array_merge($this->get_path($parent_id), $path);
+ }
+ return $path;
+ }
+
}
Modified: branches/dev-syncromind/booking/inc/class.uireports.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-09-26
15:50:13 UTC (rev 14030)
+++ branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-09-28
11:56:58 UTC (rev 14031)
@@ -13,6 +13,7 @@
'participants' => true,
'freetime' => true,
'add' => true,
+ 'get_custom' => true
);
public function __construct()
@@ -47,6 +48,8 @@
public function add()
{
+
self::set_active_menu('booking::reportcenter::add_generic');
+
$errors = array();
$report = array();
if($_SERVER['REQUEST_METHOD'] == 'POST')
@@ -172,13 +175,28 @@
array_set_default($report, 'cost', '0');
$activities =
$this->activity_bo->fetch_activities();
$activities =
$activities['results'];
- $agegroups =
$this->agegroup_bo->fetch_age_groups();
- $agegroups =
$agegroups['results'];
- $audience =
$this->audience_bo->fetch_target_audience();
- $audience =
$audience['results'];
+// $agegroups =
$this->agegroup_bo->fetch_age_groups();
+// $agegroups =
$agegroups['results'];
+// $audience =
$this->audience_bo->fetch_target_audience();
+// $audience =
$audience['results'];
- // $this->install_customer_identifier_ui($report);
+ $report['days'] = array(
+ array('id' => 1, 'name' => lang('Monday')),
+ array('id' => 2, 'name' => lang('Tuesday')),
+ array('id' => 3, 'name' => lang('Wednesday')),
+ array('id' => 4, 'name' => lang('Thursday')),
+ array('id' => 5, 'name' => lang('Friday')),
+ array('id' => 6, 'name' => lang('Saturday')),
+ array('id' => 7, 'name' => lang('Sunday'))
+ );
+ $report['variables'] = array(
+ array('id' => 'resource', 'name' =>
lang('resource')),
+ array('id' => 'audience', 'name' =>
lang('audience')),
+ array('id' => 'agegroup', 'name' =>
lang('agegroup')),
+ array('id' => 'activity', 'name' =>
lang('activities')),
+ );
+
$GLOBALS['phpgw']->jqcal->add_listener('start_date');
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
@@ -194,6 +212,82 @@
'agegroups' => $agegroups, 'audience' =>
$audience));
}
+ public function get_custom()
+ {
+ $activity_id = phpgw::get_var('activity_id', 'int');
+ $activity_path =
$this->activity_bo->get_path($activity_id);
+ $top_level_activity = $activity_path ?
$activity_path[0]['id'] : 0;
+
+
+ $location = ".application.{$top_level_activity}";
+ $organized_fields = $this->get_attributes($location);
+ $variable_vertical = '';
+ $variable_horizontal = '';
+ foreach($organized_fields as $group)
+ {
+ if($group[id] > 0)
+ {
+ $header_level = $group['level'] + 2;
+ if(isset($group['attributes']) &&
is_array($group['attributes']))
+ {
+ foreach ($group['attributes']
as $attribute)
+ {
+ $variable_vertical .=
<<<HTML
+
+ <li><input type
= "radio" name = "variable_vertical" value ="{$attribute['id']}" ></input>
+
{$attribute['input_text']} [{$attribute['trans_datatype']}] </li>
+HTML;
+ $variable_horizontal .=
<<<HTML
+
+ <li><input type
= "radio" name = "variable_horizontal" value ="{$attribute['id']}" ></input>
+
{$attribute['input_text']} [{$attribute['trans_datatype']}] </li>
+HTML;
+ }
+ }
+ }
+ }
+
+ $fields = print_r($organized_fields, true);
+
+
+ // $path = print_r($activity_path, true);
+
+
+ return array
+ (
+ 'status' => 'ok',
+ 'message' => 'melding',
+ 'variable_vertical' => $variable_vertical,
+ 'variable_horizontal' => $variable_horizontal
+ );
+ }
+ /**
+ *
+ * @param type $location
+ * @return array the grouped attributes
+ */
+ private function get_attributes($location)
+ {
+ $appname = 'booking';
+ $attributes =
$GLOBALS['phpgw']->custom_fields->find($appname, $location, 0, '', 'ASC',
'attrib_sort', true, true);
+ return $this->get_attribute_groups($appname, $location,
$attributes);
+ }
+
+ /**
+ * Arrange attributes within groups
+ *
+ * @param string $location the name of the location of the
attribute
+ * @param array $attributes the array of the attributes to
be grouped
+ *
+ * @return array the grouped attributes
+ */
+
+ private function get_attribute_groups($appname, $location,
$attributes = array())
+ {
+ return
$GLOBALS['phpgw']->custom_fields->get_attribute_groups($appname, $location,
$attributes);
+ }
+
+
public function participants()
{
self::set_active_menu('booking::reportcenter::participants');
Modified: branches/dev-syncromind/booking/js/booking/report.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/report.js 2015-09-26
15:50:13 UTC (rev 14030)
+++ branches/dev-syncromind/booking/js/booking/report.js 2015-09-28
11:56:58 UTC (rev 14031)
@@ -31,3 +31,41 @@
function populateTableChk(url, container, colDefs) {
createTable(container, url, colDefs);
}
+
+$(document).ready(function(){
+
+ $("#field_activity").change(function () {
+ oArgs = {menuaction: 'booking.uireports.get_custom'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ var activity_id =$("#field_activity").val();
+
+ $.ajax({
+ type: 'POST',
+ data: {activity_id:activity_id},
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data) {
+ if( data != null)
+ {
+ var message = data.message;
+ var variable_horizontal =
data.variable_horizontal;
+ var variable_vertical =
data.variable_vertical;
+
+ htmlString = "";
+ var msg_class = "msg_good";
+ if(data.status =='error')
+ {
+ msg_class = "error";
+ }
+ htmlString += "<div class=\"" +
msg_class + "\">";
+ htmlString += message;
+ htmlString += '</div>';
+
//$("#receipt").html(htmlString);
+
$("#custom_elements_horizontal").html( variable_horizontal );
+
$("#custom_elements_vertical").html( variable_vertical );
+ }
+ }
+ });
+
+ });
+});
\ No newline at end of file
Modified: branches/dev-syncromind/booking/templates/base/report_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/report_new.xsl
2015-09-26 15:50:13 UTC (rev 14030)
+++ branches/dev-syncromind/booking/templates/base/report_new.xsl
2015-09-28 11:56:58 UTC (rev 14031)
@@ -23,7 +23,7 @@
<div class="heading">
<legend>
<h3>
-
<xsl:value-of select="php:function('lang', 'Why')" />
+
<xsl:value-of select="php:function('lang', 'what')" />
</h3>
</legend>
</div>
@@ -64,7 +64,7 @@
</div>
<div class="pure-g">
- <div class="pure-u-1
pure-u-md-1-2 pure-u-lg-1-3">
+ <div class="pure-u-1">
<div class="heading">
<legend>
<h3>
@@ -104,7 +104,7 @@
</div>
</div>
- <div class="pure-u-1
pure-u-md-1-2 pure-u-lg-1-3">
+ <div class="pure-u-1">
<div class="heading">
<legend>
<h3>
@@ -112,56 +112,77 @@
</h3>
</legend>
</div>
- <div
id="dates-container" class="pure-control-group">
- <xsl:for-each
select="report/dates">
- <div
class="date-container">
-
<div class="pure-control-group">
-
<label for="start_date">
-
<xsl:value-of select="php:function('lang', 'From')" />
-
</label>
-
<input class="datetime pure-input-2-3" id="start_date"
name="start_date" type="text">
-
</input>
+ <div class="pure-g">
+ <div
id="dates-container" class="pure-control-group pure-u-1 pure-u-md-1-2
pure-u-lg-1">
+
<xsl:for-each select="report/dates">
+
<div class="date-container">
+
<div class="pure-control-group">
+
<label for="start_date">
+
<xsl:value-of select="php:function('lang', 'From')" />
+
</label>
+
<input class="datetime pure-input-1-2" id="start_date"
name="start_date" type="text">
+
</input>
+
</div>
+
<div class="pure-control-group">
+
<label for="end_date">
+
<xsl:value-of select="php:function('lang', 'To')" />
+
</label>
+
<input class="datetime pure-input-1-2" id="end_date"
name="end_date" type="text">
+
</input>
+
</div>
</div>
-
<div class="pure-control-group">
-
<label for="end_date">
-
<xsl:value-of select="php:function('lang', 'To')" />
-
</label>
-
<input class="datetime pure-input-2-3" id="end_date" name="end_date"
type="text">
+
</xsl:for-each>
+ <div
class="pure-control-group pure-u-1 pure-u-md-1-2 pure-u-lg-1">
+
<label for="start_time">
+
<xsl:value-of select="php:function('lang', 'start time')" />
+
</label>
+
<span>
+
<input maxlength="2" size="2" id="start_hour" name="start_hour"
type="text" placeholder = "00">
</input>
-
</div>
- </div>
- </xsl:for-each>
- <div
class="pure-control-group">
- <label
for="start_time">
-
<xsl:value-of select="php:function('lang', 'start_time')" />
- </label>
- <span>
-
<input maxlength="2" size="2" id="start_hour" name="start_hour" type="text">
+
<xsl:text>:</xsl:text>
+
<input maxlength="2" size="2" id="start_minute" name="start_minute"
type="text" placeholder = "00">
+
</input>
+
</span>
+
<label for="end_time">
+
<xsl:value-of select="php:function('lang', 'end time')" />
+
</label>
+
<input maxlength="2" size="2" class="pure-input" id="end_hour" name="end_hour"
type="text" placeholder = "00">
</input>
<xsl:text>:</xsl:text>
-
<input maxlength="2" size="2" id="start_minute" name="start_minute" type="text">
+
<input maxlength="2" size="2" class="pure-input" id="end_minute"
name="end_minute" type="text" placeholder = "00">
</input>
- </span>
- </div>
- <div
class="pure-control-group">
- <label
for="end_time">
-
<xsl:value-of select="php:function('lang', 'end_time')" />
- </label>
- <input
maxlength="2" size="2" class="pure-input" id="end_hour" name="end_hour"
type="text">
- </input>
-
<xsl:text>:</xsl:text>
- <input
maxlength="2" size="2" class="pure-input" id="end_minute" name="end_minute"
type="text">
- </input>
- </div>
+ </div>
+ </div>
</div>
+ <div
class="pure-control-group">
+ <label
for="field_weekday" style="vertical-align:top;">
+ <h4>
+
<xsl:value-of select="php:function('lang', 'Weekdays')" />
+ </h4>
+ </label>
+ <ul
id="field_weekday"
style="display:inline-block;list-style:none;padding:0px;margin:0px;">
+
<xsl:for-each select="report/days">
+
<li>
+
<label>
+
<input type="checkbox" value="{id}" name="weekdays[]" >
+
<xsl:if test="selected = 1">
+
<xsl:attribute
name="checked">checked</xsl:attribute>
+
</xsl:if>
+
</input>
+
<xsl:value-of select="name" />
+
</label>
+
</li>
+
</xsl:for-each>
+ </ul>
+ </div>
</div>
- <div class="pure-u-1
pure-u-md-1 pure-u-lg-1-3">
+ <div class="pure-u-1">
<div class="heading">
<legend>
<h3>
-
<xsl:value-of select="php:function('lang', 'Who')" />
+
<xsl:value-of select="php:function('lang', 'variables')" />
</h3>
</legend>
</div>
@@ -169,85 +190,61 @@
<div
class="pure-control-group pure-u-1 pure-u-md-1-2 pure-u-lg-1">
<label>
<h4>
-
<xsl:value-of select="php:function('lang', 'Target audience')" />
+
<xsl:value-of select="php:function('lang', 'Horizontal')" />
</h4>
</label>
- <ul
style="list-style:none;">
-
<xsl:for-each select="audience">
+ <ul id=
"variable_horizontal"
style="display:inline-block;list-style:none;padding:0px;margin:0px;">
+
<xsl:for-each select="report/variables">
<li>
-
<label style="display:inline-block;">
-
<input type="checkbox" name="audience[]">
-
<xsl:attribute name="value">
-
<xsl:value-of select="id"/>
-
</xsl:attribute>
-
<xsl:if test="../report/audience=id">
+
<label>
+
<input type="radio" value="{id}"
name="variable_horizontal" >
+
<xsl:if test="selected = 1">
<xsl:attribute
name="checked">checked</xsl:attribute>
</xsl:if>
</input>
-
<xsl:value-of select="name"/>
+
<xsl:value-of select="name" />
</label>
</li>
</xsl:for-each>
+
<div id="custom_elements_horizontal"></div>
</ul>
</div>
<div
class="pure-control-group pure-u-1 pure-u-md-1-2 pure-u-lg-1">
<label>
<h4>
-
<xsl:value-of select="php:function('lang', 'Number of participants')" />
+
<xsl:value-of select="php:function('lang', 'vertical')" />
</h4>
</label>
- <table
id="agegroup" class="pure-table pure-table-bordered">
-
<thead>
-
<tr>
-
<th></th>
-
<th>
-
<xsl:value-of select="php:function('lang', 'Male')" />
-
</th>
-
<th>
-
<xsl:value-of select="php:function('lang', 'Female')" />
-
</th>
-
</tr>
-
</thead>
-
<tbody>
-
<xsl:for-each select="agegroups">
-
<xsl:variable name="id">
-
<xsl:value-of select="id"/>
-
</xsl:variable>
-
<tr>
-
<th>
-
<xsl:value-of select="name"/>
-
</th>
-
<td>
-
<input type="text" class="input50">
-
<xsl:attribute
name="name">male[<xsl:value-of select="id"/>]</xsl:attribute>
-
<xsl:attribute name="value">
-
<xsl:value-of
select="../report/agegroups/male[../agegroup_id = $id]"/>
-
</xsl:attribute>
-
</input>
-
</td>
-
<td>
-
<input type="text" class="input50">
-
<xsl:attribute
name="name">female[<xsl:value-of select="id"/>]</xsl:attribute>
-
<xsl:attribute name="value">
-
<xsl:value-of
select="../report/agegroups/female[../agegroup_id = $id]"/>
-
</xsl:attribute>
-
</input>
-
</td>
-
</tr>
-
</xsl:for-each>
-
</tbody>
- </table>
+ <ul id=
"variable_vertical"
style="display:inline-block;list-style:none;padding:0px;margin:0px;">
+
<xsl:for-each select="report/variables">
+
<li>
+
<label>
+
<input type="radio" value="{id}"
name="variable_vertical" >
+
<xsl:if test="selected = 1">
+
<xsl:attribute
name="checked">checked</xsl:attribute>
+
</xsl:if>
+
</input>
+
<xsl:value-of select="name" />
+
</label>
+
</li>
+
</xsl:for-each>
+
<div id = "custom_elements_vertical"></div>
+ </ul>
</div>
</div>
+
</div>
+
+
</div>
+
</fieldset>
</div>
</div>
<div class="form-buttons">
<input type="submit" class="button pure-button
pure-button-primary">
<xsl:attribute name="value">
- <xsl:value-of
select="php:function('lang', 'Create')"/>
+ <xsl:value-of
select="php:function('lang', 'Create report')"/>
</xsl:attribute>
</input>
<a class="cancel">
Modified: branches/dev-syncromind/controller/templates/base/component.xsl
===================================================================
--- branches/dev-syncromind/controller/templates/base/component.xsl
2015-09-26 15:50:13 UTC (rev 14030)
+++ branches/dev-syncromind/controller/templates/base/component.xsl
2015-09-28 11:56:58 UTC (rev 14031)
@@ -364,7 +364,7 @@
success: function(data) {
if( data != null)
{
-console.log(data);
+//console.log(data);
var message = data.message;
htmlString = "";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14031] booking: statistics,
Sigurd Nes <=