fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13995] Booking: Statistics


From: Sigurd Nes
Subject: [Fmsystem-commits] [13995] Booking: Statistics
Date: Wed, 23 Sep 2015 17:00:30 +0000

Revision: 13995
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13995
Author:   sigurdne
Date:     2015-09-23 17:00:30 +0000 (Wed, 23 Sep 2015)
Log Message:
-----------
Booking: Statistics

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.menu.inc.php
    branches/dev-syncromind/booking/inc/class.uireports.inc.php

Added Paths:
-----------
    branches/dev-syncromind/booking/js/booking/report.js
    branches/dev-syncromind/booking/templates/base/report_new.xsl

Modified: branches/dev-syncromind/booking/inc/class.menu.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.menu.inc.php      2015-09-23 
09:18:40 UTC (rev 13994)
+++ branches/dev-syncromind/booking/inc/class.menu.inc.php      2015-09-23 
17:00:30 UTC (rev 13995)
@@ -213,12 +213,12 @@
                             'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'booking.uireports.freetime') ),
                                                        'image' => 
array('property', 'report'),
                         ),
-#                        'free_time2' => array
-#                        (
-#                            'text'  => lang('Free time2'),
-#                            'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'booking.uireports.freetime2') ),
-#                                                      'image' => 
array('property', 'report'),
-#                        )
+                        'add_generic' => array
+                        (
+                            'text'  => 'TESTING::add_generic',
+                            'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'booking.uireports.add') ),
+                                                       'image' => 
array('property', 'report'),
+                        )
                     )       
                 ),      
                        );

Modified: branches/dev-syncromind/booking/inc/class.uireports.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-09-23 
09:18:40 UTC (rev 13994)
+++ branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-09-23 
17:00:30 UTC (rev 13995)
@@ -1,199 +1,357 @@
 <?php
+       phpgw::import_class('booking.uicommon');
+       phpgw::import_class('phpgwapi.send');
+       phpgw::import_class('booking.uidocument_building');
+       phpgw::import_class('booking.uipermission_building');
 
-phpgw::import_class('booking.uicommon');
-phpgw::import_class('phpgwapi.send');
+       class booking_uireports extends booking_uicommon
+       {
 
-class booking_uireports extends booking_uicommon
-{
-       public $public_functions = array(
-                       'index'                 =>      true,
-            'query'                 =>      true,
-                       'participants'          =>      true,
-                       'freetime'              =>      true,
+               public $public_functions = array(
+                       'index'                  => true,
+                       'query'                  => true,
+                       'participants'   => true,
+                       'freetime'               => true,
+                       'add'                    => true,
                );
 
-       public function __construct()
-       {
-               parent::__construct();
+               public function __construct()
+               {
+                       parent::__construct();
 
-               $this->building_bo = CreateObject('booking.bobuilding');
-               self::set_active_menu('booking::reportcenter');
-       }
-    public function query() {
-        
-    }
+                       $this->building_bo = CreateObject('booking.bobuilding');
+                       self::set_active_menu('booking::reportcenter');
 
-    public function index()
-       {
-               $reports[] = array('name' => lang('Participants Per Age Group 
Per Month'), 'url' => self::link(array('menuaction' => 
'booking.uireports.participants')));
-               $reports[] = array('name' => lang('Free time'), 'url' => 
self::link(array('menuaction' => 'booking.uireports.freetime')));
+                       $this->activity_bo = CreateObject('booking.boactivity');
+                       $this->agegroup_bo = CreateObject('booking.boagegroup');
+                       $this->audience_bo = CreateObject('booking.boaudience');
+                       //remove
+                       $this->organization_bo = 
CreateObject('booking.boorganization');
+                       $this->resource_bo = CreateObject('booking.boresource');
 
-               self::render_template_xsl('report_index',array('reports' => 
$reports));
-       }
+               }
 
-       public function participants()
-       {
-               self::set_active_menu('booking::reportcenter::participants');
-               $errors = array();
-               $buildings = $this->building_bo->read();
-               $to = '2009-01-01';
-               $from = '2009-01-01';
+               public function query()
+               {
 
-               if ($_SERVER['REQUEST_METHOD'] == 'POST')
+               }
+
+               public function index()
                {
+                       $reports[]       = array('name' => lang('Participants 
Per Age Group Per Month'), 'url' => self::link(array(
+                                       'menuaction' => 
'booking.uireports.participants')));
+                       $reports[]       = array('name' => lang('Free time'), 
'url' => self::link(array('menuaction' => 'booking.uireports.freetime')));
 
-                       $to = phpgw::get_var('to', 'POST');
-                       $from = phpgw::get_var('from', 'POST');
+                       self::render_template_xsl('report_index', 
array('reports' => $reports));
+               }
 
-                       $output_type = phpgw::get_var('otype', 'POST');
-                       $building_list = phpgw::get_var('building', 'POST');
+               public function add()
+               {
+                       $errors  = array();
+                       $report  = array();
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
 
-                       if (!count($building_list))
+                               array_set_default($_POST, 'from_', array());
+                               array_set_default($_POST, 'to_', array());
+                               $report['dates'] = array_map(array(self, 
'_combine_dates'), $_POST['from_'], $_POST['to_']);
+
+                               array_set_default($_POST, 'resources', array());
+                               $report['active']        = '1';
+                               $report['completed']     = '0';
+
+                               array_set_default($report, 'audience', array());
+                               array_set_default($report, 'agegroups', 
array());
+                               $report['secret']                = 
$this->generate_secret();
+                               $report['is_public']             = 1;
+                               $report['building_name']         = 
$_POST['building_name'];
+
+                               if(!$_POST['application_id'])
+                               {
+                                       $temp_errors = array();
+                                       foreach($report['dates'] as $checkdate)
+                                       {
+                                               $report['from_']         = 
$checkdate['from_'];
+                                               $_POST['from_']  = 
$checkdate['from_'];
+                                               $report['to_']   = 
$checkdate['to_'];
+                                               $_POST['to_']    = 
$checkdate['to_'];
+                                               list($report, $errors) = 
$this->extract_and_validate($report);
+                                               $time_from               = 
explode(" ", $_POST['from_']);
+                                               $time_to                 = 
explode(" ", $_POST['to_']);
+                                               if($time_from[0] == $time_to[0])
+                                               {
+                                                       if($time_from[1] >= 
$time_to[1])
+                                                       {
+                                                               $errors['time'] 
= lang('Time is set wrong');
+                                                       }
+                                               }
+                                               if($errors != array())
+                                               {
+                                                       $temp_errors = $errors;
+                                               }
+                                       }
+                                       $errors = $temp_errors;
+                               }
+                               else
+                               {
+                                       list($report, $errors) = 
$this->extract_and_validate($report);
+                                       $time_from       = explode(" ", 
$_POST['from_']);
+                                       $time_to         = explode(" ", 
$_POST['to_']);
+                                       if($time_from[0] == $time_to[0])
+                                       {
+                                               if($time_from[1] >= $time_to[1])
+                                               {
+                                                       $errors['time'] = 
lang('Time is set wrong');
+                                               }
+                                       }
+                               }
+
+                               if($_POST['cost'] != 0 and ! 
$report['customer_organization_number'] and ! $report['customer_ssn'])
+                               {
+                                       $errors['invoice_data'] = lang('There 
is set a cost, but no invoice data is filled inn');
+                               }
+                               if(($_POST['organization_name'] != '' or 
$_POST['org_id2'] != '') and isset($errors['contact_name']))
+                               {
+                                       $errors['contact_name'] = 
lang('Organization is missing booking charge');
+                               }
+                               if(!$errors['report'] && !$errors['from_'] && 
!$errors['time'] && !$errors['invoice_data'] && !$errors['resource_number'] && 
!$errors['organization_number'] && !$errors['contact_name'] && !$errors['cost'] 
&& !$errors['activity_id'])
+                               {
+                                       if(!$_POST['application_id'])
+                                       {
+                                               $allids = array();
+                                               foreach($report['dates'] as 
$checkdate)
+                                               {
+                                                       $report['from_']        
 = $checkdate['from_'];
+                                                       $report['to_']   = 
$checkdate['to_'];
+
+                                                       
unset($report['comments']);
+                                                       
if(count($report['dates']) < 2)
+                                                       {
+                                                               
$this->add_comment($report, lang('Event was created'));
+                                                               $receipt = 
$this->bo->add($report);
+                                                       }
+                                                       else
+                                                       {
+                                                               
$this->add_comment($report, lang('Multiple Events was created'));
+                                                               $receipt        
 = $this->bo->add($report);
+                                                               $allids[]       
 = array($receipt['id']);
+                                                       }
+                                               }
+                                               if($allids)
+                                               {
+                                                       
$this->bo->so->update_comment($allids);
+                                                       
$this->bo->so->update_id_string();
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $this->add_comment($report, 
lang('Event was created'));
+                                               $receipt = 
$this->bo->add($report);
+                                               
$this->bo->so->update_id_string();
+                                       }
+                                       $this->redirect(array('menuaction' => 
'booking.uireports.edit', 'id' => $receipt['id'],
+                                               'secret' => $report['secret'], 
'warnings' => $errors));
+                               }
+                       }
+                       if($errors['report'])
                        {
-                               $errors[] = lang('No buildings selected');
+                               $errors['warning'] = lang('NB! No data will be 
saved, if you navigate away you will loose all.');
                        }
+                       $default_dates = array_map(array(self, 
'_combine_dates'), '', '');
+                       array_set_default($report, 'dates', $default_dates);
 
-                       if (!count($errors))
+                       if(!phpgw::get_var('from_report', 'POST'))
                        {
-                               $jasper_parameters = 
sprintf("\"BK_DATE_FROM|%s;BK_DATE_TO|%s;BK_BUILDINGS|%s\"",
-                                       $from,
-                                       $to,
-                                       implode(",", $building_list));
-                               // DEBUG
-                               //print_r($jasper_parameters);
-                               //exit(0);
+                               $this->flash_form_errors($errors);
+                       }
 
-                               $jasper_wrapper         = 
CreateObject('phpgwapi.jasper_wrapper');
-                               $report_source          = 
PHPGW_SERVER_ROOT.'/booking/jasper/templates/participants.jrxml';
-                               try
+                       self::add_javascript('booking', 'booking', 'report.js');
+                       array_set_default($report, 'resources', array());
+                       $report['resources_json'] = 
json_encode(array_map('intval', $report['resources']));
+                       $report['cancel_link']   = 
self::link(array('menuaction' => 'booking.uireports.index'));
+                       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'];
+
+       //              $this->install_customer_identifier_ui($report);
+
+                       $GLOBALS['phpgw']->jqcal->add_listener('start_date');
+                       $GLOBALS['phpgw']->jqcal->add_listener('end_date');
+
+                       $tabs                    = array();
+                       $tabs['generic'] = array('label' => lang('Report New'), 
'link' => '#report_new');
+                       $active_tab              = 'generic';
+
+                       $report['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
+                       self::add_javascript('booking', 'booking', 
'adddatetimepicker.js');
+
+                       $this->add_template_helpers();
+                       self::render_template_xsl('report_new', array('report' 
=> $report, 'activities' => $activities,
+                               'agegroups' => $agegroups, 'audience' => 
$audience));
+               }
+
+               public function participants()
+               {
+                       
self::set_active_menu('booking::reportcenter::participants');
+                       $errors          = array();
+                       $buildings       = $this->building_bo->read();
+                       $to                      = '2009-01-01';
+                       $from            = '2009-01-01';
+
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+
+                               $to              = phpgw::get_var('to', 'POST');
+                               $from    = phpgw::get_var('from', 'POST');
+
+                               $output_type     = phpgw::get_var('otype', 
'POST');
+                               $building_list   = phpgw::get_var('building', 
'POST');
+
+                               if(!count($building_list))
                                {
-                                       
$jasper_wrapper->execute($jasper_parameters, $output_type, $report_source);
+                                       $errors[] = lang('No buildings 
selected');
                                }
-                               catch(Exception $e)
+
+                               if(!count($errors))
                                {
-                                       $errors[] = $e->getMessage();
+                                       $jasper_parameters = 
sprintf("\"BK_DATE_FROM|%s;BK_DATE_TO|%s;BK_BUILDINGS|%s\"", $from, $to, 
implode(",", $building_list));
+                                       // DEBUG
+                                       //print_r($jasper_parameters);
+                                       //exit(0);
+
+                                       $jasper_wrapper  = 
CreateObject('phpgwapi.jasper_wrapper');
+                                       $report_source   = PHPGW_SERVER_ROOT . 
'/booking/jasper/templates/participants.jrxml';
+                                       try
+                                       {
+                                               
$jasper_wrapper->execute($jasper_parameters, $output_type, $report_source);
+                                       }
+                                       catch(Exception $e)
+                                       {
+                                               $errors[] = $e->getMessage();
+                                       }
                                }
                        }
-               }
-               else
-               {
-                       $to = date("Y-m-d", time());
-                       $from = date("Y-m-d", time());
-               }
+                       else
+                       {
+                               $to              = date("Y-m-d", time());
+                               $from    = date("Y-m-d", time());
+                       }
 
-               $this->flash_form_errors($errors);
-        
-                $GLOBALS['phpgw']->jqcal->add_listener('start_date', 'date');
-                $GLOBALS['phpgw']->jqcal->add_listener('end_date', 'date');
+                       $this->flash_form_errors($errors);
 
-                $tabs = array();
-                $tabs['generic'] = array('label' => lang('Report 
Participants'), 'link' => '#report_part');
-                $active_tab = 'generic';
+                       $GLOBALS['phpgw']->jqcal->add_listener('start_date', 
'date');
+                       $GLOBALS['phpgw']->jqcal->add_listener('end_date', 
'date');
 
-                $data = array();
-                $data['tabs'] = phpgwapi_jquery::tabview_generate($tabs, 
$active_tab);
+                       $tabs                    = array();
+                       $tabs['generic'] = array('label' => lang('Report 
Participants'), 'link' => '#report_part');
+                       $active_tab              = 'generic';
 
-               self::render_template_xsl('report_participants',array('data' => 
$data,'from' => $from, 'to' => $to, 'buildings' => $buildings['results']));
-       }
+                       $data                    = array();
+                       $data['tabs']    = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
 
-       public function freetime()
-       {
-               self::set_active_menu('booking::reportcenter::free_time');
-               $errors = array();
-               $buildings = $this->building_bo->read();
+                       self::render_template_xsl('report_participants', 
array('data' => $data, 'from' => $from,
+                               'to' => $to, 'buildings' => 
$buildings['results']));
+               }
 
-               $show = '';
-               if ($_SERVER['REQUEST_METHOD'] == 'POST')
+               public function freetime()
                {
-                       $show = 'report';
-                       $allocations = $this->get_free_allocations(
-                                       phpgw::get_var('building', 'POST'),
-                                       phpgw::get_var('from', 'POST'),
-                                       phpgw::get_var('to', 'POST'),
-                                       phpgw::get_var('weekdays', 'POST')
-                                       );
+                       
self::set_active_menu('booking::reportcenter::free_time');
+                       $errors          = array();
+                       $buildings       = $this->building_bo->read();
 
-                       $counter = 0;
-                       foreach($allocations['results'] as &$allocation)
+                       $show = '';
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
-                               $temp = array();
-                               $temp[] = array('from_', $allocation['from_']);
-                               $temp[] = array('to_', $allocation['to_']);
-                               $temp[] = array('building_id', 
$allocation['building_id']);
-                               $temp[] = array('building_name', 
$allocation['building_name']);
-                               $temp[] = array('resources[]', 
array($allocation['resource_id']));
-                               $temp[] = array('reminder', 0);
-                               $temp[] = array('from_report', true); // 
indicate that no error messages should be shown
-                               $allocation['counter'] = $counter;
-                               $allocation['event_params'] = 
json_encode($temp);
-                               $counter++;
+                               $show            = 'report';
+                               $allocations = $this->get_free_allocations(
+                               phpgw::get_var('building', 'POST'), 
phpgw::get_var('from', 'POST'), phpgw::get_var('to', 'POST'), 
phpgw::get_var('weekdays', 'POST')
+                               );
+
+                               $counter = 0;
+                               foreach($allocations['results'] as &$allocation)
+                               {
+                                       $temp                                   
         = array();
+                                       $temp[]                                 
         = array('from_', $allocation['from_']);
+                                       $temp[]                                 
         = array('to_', $allocation['to_']);
+                                       $temp[]                                 
         = array('building_id', $allocation['building_id']);
+                                       $temp[]                                 
         = array('building_name', $allocation['building_name']);
+                                       $temp[]                                 
         = array('resources[]', array($allocation['resource_id']));
+                                       $temp[]                                 
         = array('reminder', 0);
+                                       $temp[]                                 
         = array('from_report', true); // indicate that no error messages 
should be shown
+                                       $allocation['counter']           = 
$counter;
+                                       $allocation['event_params']      = 
json_encode($temp);
+                                       $counter++;
+                               }
+                               if(count($allocations['results']) == 0)
+                               {
+                                       $show            = 'gui';
+                                       $errors[]        = lang('no records 
found.');
+                                       $to                      = 
phpgw::get_var('to', 'POST');
+                                       $from            = 
phpgw::get_var('from', 'POST');
+                               }
                        }
-                       if (count($allocations['results']) == 0)
+                       else
                        {
-                               $show = 'gui';
-                               $errors[] = lang('no records found.');
-                               $to = phpgw::get_var('to', 'POST');
-                               $from = phpgw::get_var('from', 'POST');
+                               $to              = date("Y-m-d", time());
+                               $from    = date("Y-m-d", time());
+                               $show    = 'gui';
                        }
-               }
-               else
-               {
-                       $to = date("Y-m-d", time());
-                       $from = date("Y-m-d", time());
-                       $show = 'gui';
-               }
 
-               $this->flash_form_errors($errors);
-        
-                $GLOBALS['phpgw']->jqcal->add_listener('start_date', 'date');
-                $GLOBALS['phpgw']->jqcal->add_listener('end_date', 'date');
+                       $this->flash_form_errors($errors);
 
-                $tabs = array();
-                $tabs['generic'] = array('label' => lang('Report FreeTime'), 
'link' => '#report_freetime');
-                $active_tab = 'generic';
+                       $GLOBALS['phpgw']->jqcal->add_listener('start_date', 
'date');
+                       $GLOBALS['phpgw']->jqcal->add_listener('end_date', 
'date');
 
-                $data = array();
-                $data['tabs'] = phpgwapi_jquery::tabview_generate($tabs, 
$active_tab);
+                       $tabs                    = array();
+                       $tabs['generic'] = array('label' => lang('Report 
FreeTime'), 'link' => '#report_freetime');
+                       $active_tab              = 'generic';
 
-               self::render_template_xsl('report_freetime',
-                               array('data'=>$data, 'show' => $show, 'from' => 
$from, 'to' => $to, 'buildings' => $buildings['results'], 'allocations' => 
$allocations['results']));
-       }
+                       $data                    = array();
+                       $data['tabs']    = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
 
-       private function get_free_allocations($buildings, $from, $to, $weekdays)
-       {
-               $db = & $GLOBALS['phpgw']->db;
+                       self::render_template_xsl('report_freetime', 
array('data' => $data, 'show' => $show,
+                               'from' => $from, 'to' => $to, 'buildings' => 
$buildings['results'], 'allocations' => $allocations['results']));
+               }
 
-               $buildings = implode(",", $buildings);
-               $weekdays = implode(",", $weekdays);
+               private function get_free_allocations($buildings, $from, $to, 
$weekdays)
+               {
+                       $db = & $GLOBALS['phpgw']->db;
 
-               $sql = "select distinct al.id, al.from_, al.to_, EXTRACT(DOW 
FROM al.to_) as day_of_week, bu.id as building_id, bu.name as building_name, 
br.id as resource_id, br.name as resource_name
+                       $buildings       = implode(",", $buildings);
+                       $weekdays        = implode(",", $weekdays);
+
+                       $sql = "select distinct al.id, al.from_, al.to_, 
EXTRACT(DOW FROM al.to_) as day_of_week, bu.id as building_id, bu.name as 
building_name, br.id as resource_id, br.name as resource_name
                                from bb_allocation al
                                inner join bb_allocation_resource ar on 
ar.allocation_id = al.id
                                inner join bb_resource br on br.id = 
ar.resource_id and br.active = 1
                                inner join bb_building bu on bu.id = 
br.building_id
                                left join bb_booking bb on bb.allocation_id = 
al.id
                                where bb.id is null 
-                               and al.from_ >= '".$from." 00:00:00'
-                               and al.to_ <= '".$to." 23:59:59' ";
+                               and al.from_ >= '" . $from . " 00:00:00'
+                               and al.to_ <= '" . $to . " 23:59:59' ";
 
-               if ($buildings)
-                       $sql .= "and building_id in (".$buildings.") ";
+                       if($buildings)
+                               $sql .= "and building_id in (" . $buildings . 
") ";
 
-               if ($weekdays)
-                       $sql .= "and EXTRACT(DOW FROM al.from_) in 
(".$weekdays.") ";
-               
-               $sql .= "order by building_name, from_, to_, resource_name";
-               $db->query($sql);
+                       if($weekdays)
+                               $sql .= "and EXTRACT(DOW FROM al.from_) in (" . 
$weekdays . ") ";
 
-               $result = $db->resultSet;
+                       $sql .= "order by building_name, from_, to_, 
resource_name";
+                       $db->query($sql);
 
-               $retval = array();
-               $retval['total_records'] = count($result);
-               $retval['results'] = $result;
-               $retval['start'] = 0;
-               $retval['sort'] = null;
-               $retval['dir'] = 'asc';
+                       $result = $db->resultSet;
 
-               return $retval;
-       }
-}
+                       $retval                                  = array();
+                       $retval['total_records'] = count($result);
+                       $retval['results']               = $result;
+                       $retval['start']                 = 0;
+                       $retval['sort']                  = null;
+                       $retval['dir']                   = 'asc';
+
+                       return $retval;
+               }
+       }
\ No newline at end of file

Added: branches/dev-syncromind/booking/js/booking/report.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/report.js                        
        (rev 0)
+++ branches/dev-syncromind/booking/js/booking/report.js        2015-09-23 
17:00:30 UTC (rev 13995)
@@ -0,0 +1,33 @@
+var building_id_selection = "";
+$(document).ready(function () {
+       oArgs = {menuaction: 'booking.uibuilding.index'};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+       JqueryPortico.autocompleteHelper(requestUrl, 'field_building_name', 
'field_building_id', 'building_container');
+});
+
+$(window).load(function () {
+       var building_id = $('#field_building_id').val();
+       if (building_id) {
+               populateTableChkResources(building_id, initialSelection);
+               building_id_selection = building_id;
+       }
+       $("#field_building_name").on("autocompleteselect", function (event, ui) 
{
+               var building_id = ui.item.value;
+               if (building_id != building_id_selection) {
+                       populateTableChkResources(building_id, []);
+                       building_id_selection = building_id;
+               }
+       });
+});
+
+function populateTableChkResources(building_id, selection) {
+       oArgs = {menuaction: 'booking.uiresource.index', sort:'name', 
filter_building_id:building_id};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+       var container = 'resources_container';
+       var colDefsResources = [{label: '', object: [{type: 'input', attrs: 
[{name: 'type', value: 'checkbox'}, {name: 'name', value: 'resources[]'}]}], 
value: 'id', checked: selection}, {key: 'name', label: lang['Name']}, {key: 
'type', label: lang['Resource Type']}];
+       populateTableChk(requestUrl, container, colDefsResources);
+}
+
+function populateTableChk(url, container, colDefs) {
+       createTable(container, url, colDefs);
+}

Added: branches/dev-syncromind/booking/templates/base/report_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/report_new.xsl               
                (rev 0)
+++ branches/dev-syncromind/booking/templates/base/report_new.xsl       
2015-09-23 17:00:30 UTC (rev 13995)
@@ -0,0 +1,265 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+    <style type="text/css">
+        #agegroup td {padding: 0 0.3em;}        
+    </style>
+    <!--div id="content">
+
+       <dl class="form">
+               <dt class="heading"><xsl:value-of select="php:function('lang', 
'New report')"/></dt>
+       </dl-->
+       <xsl:call-template name="msgbox"/>
+       <!--xsl:call-template name="yui_booking_i18n"/-->
+
+       <form action="" method="POST" id='form' class="pure-form 
pure-form-stacked" name="form">
+               <input type="hidden" name="tab" value=""/>
+               <div id="tab-content">
+                       <xsl:value-of disable-output-escaping="yes" 
select="report/tabs"/>
+                       <div id="report_new">
+                               <fieldset>
+                                       <input type="hidden" 
name="application_id" value="{report/application_id}"/>
+                        
+                                       <div class="pure-g">
+                                               <div class="pure-u-1">
+                                                       <div class="heading">
+                                                               <legend>
+                                                                       <h3>
+                                                                               
<xsl:value-of select="php:function('lang', 'Why')" />
+                                                                       </h3>
+                                                               </legend>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label 
for="field_activity">
+                                                                       <h4>
+                                                                               
<xsl:value-of select="php:function('lang', 'Activity')" />
+                                                                       </h4>
+                                                               </label>
+                                                               <select 
name="activity_id" id="field_activity" class="pure-u-1 pure-u-sm-1-2 
pure-u-lg-1-3">
+                                                                       <option 
value="">
+                                                                               
<xsl:value-of select="php:function('lang', '-- select an activity --')" />
+                                                                       
</option>
+                                                                       
<xsl:for-each select="activities">
+                                                                               
<option>
+                                                                               
        <xsl:if test="../report/activity_id = id">
+                                                                               
                <xsl:attribute name="selected">selected</xsl:attribute>
+                                                                               
        </xsl:if>
+                                                                               
        <xsl:attribute name="value">
+                                                                               
                <xsl:value-of select="id"/>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:value-of select="name"/>
+                                                                               
</option>
+                                                                       
</xsl:for-each>
+                                                               </select>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label 
for="field_description">
+                                                                       <h4>
+                                                                               
<xsl:value-of select="php:function('lang', 'Description')" />
+                                                                       </h4>
+                                                               </label>
+                                                               <textarea 
id="field_description" class="full-width pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3" 
name="description">
+                                                                       
<xsl:value-of select="report/description"/>
+                                                               </textarea>
+                                                       </div>
+                                               </div>
+                                       </div>
+                        
+                                       <div class="pure-g">
+                                               <div class="pure-u-1 
pure-u-md-1-2 pure-u-lg-1-3">
+                                                       <div class="heading">
+                                                               <legend>
+                                                                       <h3>
+                                                                               
<xsl:value-of select="php:function('lang', 'Where')" />
+                                                                       </h3>
+                                                               </legend>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       <h4>
+                                                                               
<xsl:value-of select="php:function('lang', 'Building')" />
+                                                                       </h4>
+                                                               </label>
+                                                               <!--div 
class="autocomplete"-->
+                                                               <input 
id="field_building_id" name="building_id" type="hidden">
+                                                                       
<xsl:attribute name="value">
+                                                                               
<xsl:value-of select="report/building_id"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <input 
id="field_building_name" name="building_name" type="text" class="pure-u-1 
pure-u-sm-1-2 pure-u-md-1">
+                                                                       
<xsl:attribute name="value">
+                                                                               
<xsl:value-of select="report/building_name"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <!--div 
id="building_container"/>
+                                                               </div-->
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       <h4>
+                                                                               
<xsl:value-of select="php:function('lang', 'Resources')" />
+                                                                       </h4>
+                                                               </label>
+                                                               <div 
id="resources_container">
+                                                                       
<xsl:value-of select="php:function('lang', 'Select a building first')" />
+                                                               </div>
+                                                       </div>
+                                               </div>
+                            
+                                               <div class="pure-u-1 
pure-u-md-1-2 pure-u-lg-1-3">
+                                                       <div class="heading">
+                                                               <legend>
+                                                                       <h3>
+                                                                               
<xsl:value-of select="php:function('lang', 'When?')" />
+                                                                       </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>
+                                                                               
<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">
+                                                                               
        </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">
+                                                                               
</input>
+                                                                               
<xsl:text>:</xsl:text>
+                                                                               
<input maxlength="2" size="2" id="start_minute" name="start_minute" type="text">
+                                                                               
</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 class="pure-u-1 
pure-u-md-1 pure-u-lg-1-3">
+                                                       <div class="heading">
+                                                               <legend>
+                                                                       <h3>
+                                                                               
<xsl:value-of select="php:function('lang', 'Who')" />
+                                                                       </h3>
+                                                               </legend>
+                                                       </div>
+                                                       <div class="pure-g">
+                                                               <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')" />
+                                                                               
</h4>
+                                                                       </label>
+                                                                       <ul 
style="list-style:none;">
+                                                                               
<xsl:for-each select="audience">
+                                                                               
        <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">
+                                                                               
                                        <xsl:attribute 
name="checked">checked</xsl:attribute>
+                                                                               
                                </xsl:if>
+                                                                               
                        </input>
+                                                                               
                        <xsl:value-of select="name"/>
+                                                                               
                </label>
+                                                                               
        </li>
+                                                                               
</xsl:for-each>
+                                                                       </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')" />
+                                                                               
</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>
+                                                               </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:attribute>
+                       </input>
+                       <a class="cancel">
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="report/cancel_link"/>
+                               </xsl:attribute>
+                               <xsl:value-of select="php:function('lang', 
'Cancel')" />
+                       </a>
+               </div>
+       </form>
+       <script type="text/javascript">
+               var initialSelection = <xsl:value-of 
select="report/resources_json"/>;
+               var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'From', 'To', 'Resource Type')"/>;
+       </script>
+</xsl:template>




reply via email to

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