fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16894] More on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [16894] More on eventplanner
Date: Sun, 2 Jul 2017 12:05:58 -0400 (EDT)

Revision: 16894
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16894
Author:   sigurdne
Date:     2017-07-02 12:05:57 -0400 (Sun, 02 Jul 2017)
Log Message:
-----------
More on eventplanner

Modified Paths:
--------------
    trunk/eventplanner/inc/class.bocustomer_report.inc.php
    trunk/eventplanner/inc/class.bovendor_report.inc.php
    trunk/eventplanner/inc/class.uicustomer_report.inc.php
    trunk/eventplanner/inc/class.uivendor_report.inc.php
    trunk/eventplanner/setup/phpgw_no.lang
    trunk/phpgwapi/inc/class.bocommon.inc.php
    trunk/property/templates/base/columns.xsl

Modified: trunk/eventplanner/inc/class.bocustomer_report.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bocustomer_report.inc.php      2017-06-30 
16:05:29 UTC (rev 16893)
+++ trunk/eventplanner/inc/class.bocustomer_report.inc.php      2017-07-02 
16:05:57 UTC (rev 16894)
@@ -86,6 +86,12 @@
 
                        $values =  
eventplanner_socustomer_report::get_instance()->read($params);
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                       $custom = createObject('property.custom_fields');
+                       $custom_fields = (array)$custom->find('eventplanner', 
$this->acl_location, 0, '', '', '', true, false);
+                       $selected = 
(array)$GLOBALS['phpgw_info']['user']['preferences']['eventplanner']['customer_report_columns'];
+                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('eventplanner', $this->acl_location);
+
                        foreach ($values['results'] as &$entry)
                        {
                                $entry['created'] = 
$GLOBALS['phpgw']->common->show_date($entry['created']);
@@ -92,6 +98,21 @@
                                $entry['modified'] = 
$GLOBALS['phpgw']->common->show_date($entry['modified']);
                                $entry['date_start'] = 
$GLOBALS['phpgw']->common->show_date($entry['date_start'], $dateformat);
                                $entry['date_end'] = 
$GLOBALS['phpgw']->common->show_date($entry['date_end'], $dateformat);
+
+                               foreach ($custom_fields as $custom_field)
+                               {
+                                       if( in_array( $custom_field['id'], 
$selected)  ||  $custom_field['list'])
+                                       {
+                                               $entry[$custom_field['name']] = 
$custom->get_translated_value(
+                                                       array(
+                                                               'value' => 
$entry['json_representation'][$custom_field['name']],
+                                                               'datatype' => 
$custom_field['datatype'],
+                                                               'attrib_id' => 
$custom_field['id']
+                                                       ),
+                                                       $location_id
+                                               );
+                                       }
+                               }
                        }
                        return $values;
                }
@@ -109,4 +130,20 @@
 
                        return $values;
                }
+
+               function column_list( $selected = '', $allrows = '' )
+               {
+                       if (!$selected)
+                       {
+                               $selected = 
(array)$GLOBALS['phpgw_info']['user']['preferences']['eventplanner']['customer_report_columns'];
+                       }
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = 
createObject('phpgwapi.custom_fields')->find('eventplanner', 
$this->acl_location, 0, '', '', '', true, false, $filter);
+                       foreach ($columns as &$column)
+                       {
+                               $column['name'] = $column['descr'] ? 
$column['descr'] : $column['input_text'];
+                       }
+                       $column_list = $this->select_multi_list($selected, 
$columns);
+                       return $column_list;
+               }
        }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.bovendor_report.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bovendor_report.inc.php        2017-06-30 
16:05:29 UTC (rev 16893)
+++ trunk/eventplanner/inc/class.bovendor_report.inc.php        2017-07-02 
16:05:57 UTC (rev 16894)
@@ -86,6 +86,12 @@
 
                        $values =  
eventplanner_sovendor_report::get_instance()->read($params);
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                       $custom = createObject('property.custom_fields');
+                       $custom_fields = (array)$custom->find('eventplanner', 
$this->acl_location, 0, '', '', '', true, false);
+                       $selected = 
(array)$GLOBALS['phpgw_info']['user']['preferences']['eventplanner']['vendor_report_columns'];
+                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('eventplanner', $this->acl_location);
+
                        foreach ($values['results'] as &$entry)
                        {
                                $entry['created'] = 
$GLOBALS['phpgw']->common->show_date($entry['created']);
@@ -92,6 +98,21 @@
                                $entry['modified'] = 
$GLOBALS['phpgw']->common->show_date($entry['modified']);
                                $entry['date_start'] = 
$GLOBALS['phpgw']->common->show_date($entry['date_start'], $dateformat);
                                $entry['date_end'] = 
$GLOBALS['phpgw']->common->show_date($entry['date_end'], $dateformat);
+
+                               foreach ($custom_fields as $custom_field)
+                               {
+                                       if( in_array( $custom_field['id'], 
$selected)  ||  $custom_field['list'])
+                                       {
+                                               $entry[$custom_field['name']] = 
$custom->get_translated_value(
+                                                       array(
+                                                               'value' => 
$entry['json_representation'][$custom_field['name']],
+                                                               'datatype' => 
$custom_field['datatype'],
+                                                               'attrib_id' => 
$custom_field['id']
+                                                       ),
+                                                       $location_id
+                                               );
+                                       }
+                               }
                        }
                        return $values;
                }
@@ -109,4 +130,21 @@
 
                        return $values;
                }
+
+               function column_list( $selected = '', $allrows = '' )
+               {
+                       if (!$selected)
+                       {
+                               $selected = 
(array)$GLOBALS['phpgw_info']['user']['preferences']['eventplanner']['vendor_report_columns'];
+                       }
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = 
createObject('phpgwapi.custom_fields')->find('eventplanner', 
$this->acl_location, 0, '', '', '', true, false, $filter);
+                       foreach ($columns as &$column)
+                       {
+                               $column['name'] = $column['descr'] ? 
$column['descr'] : $column['input_text'];
+                       }
+                       $column_list = $this->select_multi_list($selected, 
$columns);
+                       return $column_list;
+               }
+
        }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.uicustomer_report.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uicustomer_report.inc.php      2017-06-30 
16:05:29 UTC (rev 16893)
+++ trunk/eventplanner/inc/class.uicustomer_report.inc.php      2017-07-02 
16:05:57 UTC (rev 16894)
@@ -35,6 +35,7 @@
        {
 
                public $public_functions = array(
+                       'columns' => true,
                        'add' => true,
                        'index' => true,
                        'query' => true,
@@ -60,6 +61,8 @@
                        $this->custom_fields = 
eventplanner_customer_report::get_instance()->get_custom_fields();
                        $this->currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        
self::set_active_menu("{$this->currentapp}::customer_report");
+                       $this->account = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->acl_location = 
eventplanner_customer_report::acl_location;
                }
 
 
@@ -79,6 +82,76 @@
                        return $combos;
 
                }
+
+               function columns()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('columns'), 
PHPGW_SERVER_ROOT."/property/templates/base");
+
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+
+                       $values = phpgw::get_var('values');
+                       $receipt = array();
+
+                       if (isset($values['save']) && $values['save'])
+                       {
+                               $GLOBALS['phpgw']->preferences->account_id = 
$this->account;
+                               $GLOBALS['phpgw']->preferences->read();
+                               
$GLOBALS['phpgw']->preferences->add('eventplanner', 'customer_report_columns', 
(array)$values['columns'], 'user');
+                               
$GLOBALS['phpgw']->preferences->save_repository();
+
+                               $receipt['message'][] = array('msg' => 
lang('columns is updated'));
+                       }
+
+                       $function_msg = lang('Select Column');
+
+                       $link_data = array
+                               (
+                               'menuaction' => 
"{$this->currentapp}.uicustomer_report.columns",
+                       );
+
+                       $msgbox_data = $this->bo->msgbox_data($receipt);
+//                     self::message_set($receipt);
+
+                       $data = array
+                               (
+                               'msgbox_data' => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'column_list' => 
$this->bo->column_list($values['columns'], $allrows = true),
+                               'function_msg' => $function_msg,
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'lang_columns' => lang('columns'),
+                               'lang_none' => lang('None'),
+                               'lang_save' => lang('save'),
+                       );
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
$function_msg;
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('columns' => $data));
+               }
+
+
+               function _get_fields()
+               {
+                       $fields = parent::_get_fields();
+                       $custom_fields = 
(array)createObject('phpgwapi.custom_fields')->find('eventplanner', 
$this->acl_location, 0, '', '', '', true, false);
+                       $selected = 
(array)$GLOBALS['phpgw_info']['user']['preferences']['eventplanner']['customer_report_columns'];
+
+                       foreach ($custom_fields as $custom_field)
+                       {
+                               if( in_array( $custom_field['id'], $selected)  
||  $custom_field['list'])
+                               {
+                                       $fields[] = array(
+                                               'key' => $custom_field['name'],
+                                               'label' =>  
$custom_field['input_text'],
+                                               'sortable' => true,
+                                               'hidden' => false,
+                                       );
+                               }
+                       }
+
+                       return $fields;
+
+               }
                public function index()
                {
                        if (empty($this->permissions[PHPGW_ACL_READ]))
@@ -109,9 +182,9 @@
                                                'phpgw_return_as' => 'json'
                                        )),
                                        'allrows' => true,
-       //                              'new_item' => 
self::link(array('menuaction' => 'eventplanner.uicustomer_report.add')),
+                                       "columns" => array('onclick' => 
"JqueryPortico.openPopup({menuaction:'{$this->currentapp}.uicustomer_report.columns'},
 {closeAction:'reload'})"),
                                        'editor_action' => '',
-                                       'field' => parent::_get_fields()
+                                       'field' => self::_get_fields()
                                )
                        );
 

Modified: trunk/eventplanner/inc/class.uivendor_report.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uivendor_report.inc.php        2017-06-30 
16:05:29 UTC (rev 16893)
+++ trunk/eventplanner/inc/class.uivendor_report.inc.php        2017-07-02 
16:05:57 UTC (rev 16894)
@@ -35,6 +35,7 @@
        {
 
                public $public_functions = array(
+                       'columns' => true,
                        'add' => true,
                        'index' => true,
                        'query' => true,
@@ -60,6 +61,8 @@
                        $this->custom_fields = 
eventplanner_vendor_report::get_instance()->get_custom_fields();
                        $this->currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        
self::set_active_menu("{$this->currentapp}::vendor_report");
+                       $this->account = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->acl_location = 
eventplanner_vendor_report::acl_location;
                }
 
 
@@ -79,6 +82,77 @@
                        return $combos;
 
                }
+
+               function columns()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('columns'), 
PHPGW_SERVER_ROOT."/property/templates/base");
+
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+
+                       $values = phpgw::get_var('values');
+                       $receipt = array();
+
+                       if (isset($values['save']) && $values['save'])
+                       {
+                               $GLOBALS['phpgw']->preferences->account_id = 
$this->account;
+                               $GLOBALS['phpgw']->preferences->read();
+                               
$GLOBALS['phpgw']->preferences->add('eventplanner', 'vendor_report_columns', 
(array)$values['columns'], 'user');
+                               
$GLOBALS['phpgw']->preferences->save_repository();
+
+                               $receipt['message'][] = array('msg' => 
lang('columns is updated'));
+                       }
+
+                       $function_msg = lang('Select Column');
+
+                       $link_data = array
+                               (
+                               'menuaction' => 
"{$this->currentapp}.uivendor_report.columns",
+                       );
+
+                       $msgbox_data = $this->bo->msgbox_data($receipt);
+//                     self::message_set($receipt);
+
+                       $data = array
+                               (
+                               'msgbox_data' => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'column_list' => 
$this->bo->column_list($values['columns'], $allrows = true),
+                               'function_msg' => $function_msg,
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'lang_columns' => lang('columns'),
+                               'lang_none' => lang('None'),
+                               'lang_save' => lang('save'),
+                       );
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
$function_msg;
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('columns' => $data));
+               }
+
+
+               function _get_fields()
+               {
+                       $fields = parent::_get_fields();
+                       $custom_fields = 
(array)createObject('phpgwapi.custom_fields')->find('eventplanner', 
$this->acl_location, 0, '', '', '', true, false, $filter);
+                       $selected = 
(array)$GLOBALS['phpgw_info']['user']['preferences']['eventplanner']['vendor_report_columns'];
+
+                       foreach ($custom_fields as $custom_field)
+                       {
+                               if( in_array( $custom_field['id'], $selected)  
||  $custom_field['list'])
+                               {
+                                       $fields[] = array(
+                                               'key' => $custom_field['name'],
+                                               'label' =>  
$custom_field['input_text'],
+                                               'sortable' => true,
+                                               'hidden' => false,
+                                       );
+                               }
+                       }
+
+                       return $fields;
+
+               }
+
                public function index()
                {
                        if (empty($this->permissions[PHPGW_ACL_READ]))
@@ -109,9 +183,9 @@
                                                'phpgw_return_as' => 'json'
                                        )),
                                        'allrows' => true,
-       //                              'new_item' => 
self::link(array('menuaction' => 'eventplanner.uivendor_report.add')),
+                                       "columns" => array('onclick' => 
"JqueryPortico.openPopup({menuaction:'{$this->currentapp}.uivendor_report.columns'},
 {closeAction:'reload'})"),
                                        'editor_action' => '',
-                                       'field' => parent::_get_fields()
+                                       'field' => self::_get_fields()
                                )
                        );
 

Modified: trunk/eventplanner/setup/phpgw_no.lang
===================================================================
--- trunk/eventplanner/setup/phpgw_no.lang      2017-06-30 16:05:29 UTC (rev 
16893)
+++ trunk/eventplanner/setup/phpgw_no.lang      2017-07-02 16:05:57 UTC (rev 
16894)
@@ -71,7 +71,7 @@
 wardrobe       eventplanner    no      Kryss av for behov for utøvergarderobe
 audience limit eventplanner    no      Maksimum antall publikum
 raider eventplanner    no      Andre raiderønsker – (valgfri)
-vendor report  eventplanner    no      Utøverrapport
+vendor report  eventplanner    no      Tilbakemelding fra utøver
 calendar       eventplanner    no      Kalender
 from   eventplanner    no      Fra
 event start    eventplanner    no      Ønsket arrangement dato/tid
@@ -79,12 +79,12 @@
 select all     eventplanner    no      Velg alle
 enable eventplanner    no      Aktiver
 disable        eventplanner    no      Deaktiver
-reports        eventplanner    no      Rapporter
+reports        eventplanner    no      Tilbakemeldinger
 location       eventplanner    no      Lokalisering
 who    eventplanner    no      Hvem
 note   eventplanner    no      Merknad
 customer       eventplanner    no      Mottakersted
-customer report        eventplanner    no      Rapport fra mottakersted
+customer report        eventplanner    no      Tilbakemelding fra mottakersted
 organization number    eventplanner    no      Organisasjonsnummer
 program type   eventplanner    no      Programtype
 program title  eventplanner    no      Programtittel
@@ -100,7 +100,7 @@
 did not validate       eventplanner    no      Feil med datasettet
 date is outside the scope      eventplanner    no      Dato ligger utenfor 
tillat tidsrom
 can not delete booking with customer   eventplanner    no      Kan ikke slette 
booking som er koplet med mottakersted
-report eventplanner    no      Rapport
+report eventplanner    no      Tilbakemelding
 events eventplanner    no      Arrangementer
 event  eventplanner    no      Arrangement
 please enter a valid organization number       eventplanner    no      Angi et 
gyldig organisasjonsnummer

Modified: trunk/phpgwapi/inc/class.bocommon.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.bocommon.inc.php   2017-06-30 16:05:29 UTC (rev 
16893)
+++ trunk/phpgwapi/inc/class.bocommon.inc.php   2017-07-02 16:05:57 UTC (rev 
16894)
@@ -180,4 +180,42 @@
                                }
                        }
                }
+
+               function select_multi_list( $selected = array(), $list )
+               {
+                       if (isset($list) && is_array($list) && isset($selected) 
&& is_array($selected))
+                       {
+                               foreach ($list as & $entry)
+                               {
+                                       $entry['selected'] = in_array( 
$entry['id'], $selected) ? 1 : 0;
+                               }
+                       }
+                       return $list;
+               }
+
+               function msgbox_data( $receipt )
+               {
+                       $msgbox_data_error = array();
+                       $msgbox_data_message = array();
+                       if (isset($receipt['error']) && 
is_array($receipt['error']))
+                       {
+                               foreach ($receipt['error'] as $dummy => $error)
+                               {
+                                       $msgbox_data_error[$error['msg']] = 
false;
+                               }
+                       }
+
+                       if (isset($receipt['message']) && 
is_array($receipt['message']))
+                       {
+                               foreach ($receipt['message'] as $dummy => 
$message)
+                               {
+                                       $msgbox_data_message[$message['msg']] = 
true;
+                               }
+                       }
+
+                       $msgbox_data = array_merge($msgbox_data_error, 
$msgbox_data_message);
+
+                       return $msgbox_data;
+               }
+
        }
\ No newline at end of file

Modified: trunk/property/templates/base/columns.xsl
===================================================================
--- trunk/property/templates/base/columns.xsl   2017-06-30 16:05:29 UTC (rev 
16893)
+++ trunk/property/templates/base/columns.xsl   2017-07-02 16:05:57 UTC (rev 
16894)
@@ -51,7 +51,7 @@
                <div class="pure-control-group">
                        <label for="column{$id}"  class="pure-checkbox">
                        <input id="column{$id}" name="values[columns][]" 
value="{$id}" type="checkbox">
-                               <xsl:if test="selected">
+                               <xsl:if test="selected = 1 or selected = 
'selected'">
                                        <xsl:attribute name="checked">
                                                <xsl:text>checked</xsl:text>
                                        </xsl:attribute>




reply via email to

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