fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7633]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7633]
Date: Fri, 16 Sep 2011 10:23:41 +0000

Revision: 7633
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7633
Author:   erikhl
Date:     2011-09-16 10:23:41 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.soprocedure.inc.php
    trunk/controller/inc/class.uiprocedure.inc.php

Modified: trunk/controller/inc/class.soprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.soprocedure.inc.php      2011-09-16 09:24:51 UTC 
(rev 7632)
+++ trunk/controller/inc/class.soprocedure.inc.php      2011-09-16 10:23:41 UTC 
(rev 7633)
@@ -173,7 +173,7 @@
                        $like_clauses = array();
                        switch($search_type){
                                default:
-                                       $like_clauses[] = "controller_procedure 
$this->like $like_pattern";
+                                       $like_clauses[] = 
"controller_procedure.title $this->like $like_pattern";
                                        break;
                        }
                        if(count($like_clauses))
@@ -274,7 +274,7 @@
                
                if(isset($filters[$this->get_id_field_name()]))
                {
-                       $filter_clauses[] = "controller_procedure = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+                       $filter_clauses[] = "controller_procedure.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
                }
 
                if(count($filter_clauses))
@@ -295,7 +295,7 @@
                }
                else
                {
-                       $cols .= "controller_procedure.id AS procedure_id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.respontibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment ";
+                       $cols .= "controller_procedure.id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.responsibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment ";
                }
                $dir = $ascending ? 'ASC' : 'DESC';
                $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';

Modified: trunk/controller/inc/class.uiprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.uiprocedure.inc.php      2011-09-16 09:24:51 UTC 
(rev 7632)
+++ trunk/controller/inc/class.uiprocedure.inc.php      2011-09-16 10:23:41 UTC 
(rev 7633)
@@ -28,8 +28,165 @@
                
                public function index()
                {
-                       $this->render('procedure_list.php');
+                       
//self::set_active_menu('controller::control_item2::control_item_list2');
+                       if(phpgw::get_var('phpgw_return_as') == 'json') {
+                               return $this->query();
+                       }
+                       self::add_javascript('controller', 'yahoo', 
'datatable.js');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('paginator');
+
+                       $data = array(
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
lang('f_new_procedure'),
+                                                               'href' => 
self::link(array('menuaction' => 'controller.uiprocedure.add'))
+                                                       ),
+                                                       array('type' => 'text', 
+                                'text' => lang('search'),
+                                                               'name' => 
'query'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'submit',
+                                                               'name' => 
'search',
+                                                               'value' => 
lang('Search')
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                               'datatable' => array(
+                                       'source' => 
self::link(array('menuaction' => 'controller.uiprocedure.index', 
'phpgw_return_as' => 'json')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 'id',
+                                                       'label' => lang('ID'),
+                                                       'sortable'      => true,
+                                                       'formatter' => 
'YAHOO.portico.formatLink'
+                                               ),
+                                               array(
+                                                       'key' => 'title',
+                                                       'label' => 
lang('Title'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
+                                                       'key' => 'link',
+                                                       'hidden' => true
+                                               )
+                                       )
+                               ),
+                       );
+//_debug_array($data);
+
+                       self::render_template_xsl('datatable', $data);
                }
+
+/*             public function display_control_items_json()
+               {
+                       $this->bo = CreateObject('booking.boapplication');
+                       $this->resource_bo = CreateObject('booking.boresource');
+
+                       if ( 
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
+                            $GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'controller') )
+                       {
+                               $filters['id'] = 
$this->bo->accessable_applications($GLOBALS['phpgw_info']['user']['id']);
+                       }
+                       $filters['status'] = 'NEW';
+                       if(isset($_SESSION['showall']))
+                       {
+                               $filters['status'] = array('NEW', 
'PENDING','REJECTED', 'ACCEPTED');
+                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
+                if ($testdata != 0)
+                {
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
+                }
+                else
+                {
+                    unset($filters['building_name']);                
+                }
+                $testdata2 =  phpgw::get_var('activities', 'int', 'REQUEST', 
null);
+                if ($testdata2 != 0)
+                {
+                    $filters['activity_id'] = 
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST', 
null));        
+                }
+                else
+                {
+                    unset($filters['activity_id']);                
+                }
+                
+                       }
+                       else
+                       {
+                               if (phpgw::get_var('status') == 'none')
+                               {
+                                       $filters['status'] = array('NEW', 
'PENDING', 'REJECTED', 'ACCEPTED');
+                               } 
+                               else
+                               {
+                       $filters['status'] = phpgw::get_var('status');
+                               }
+                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
+                if ($testdata != 0)
+                {
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
+                }
+                else
+                {
+                    unset($filters['building_name']);                
+                }
+                $testdata2 =  phpgw::get_var('activities', 'int', 'REQUEST', 
null);
+                if ($testdata2 != 0)
+                {
+                    $filters['activity_id'] = 
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST', 
null));        
+                }
+                else
+                {
+                    unset($filters['activity_id']);                
+                }
+            }
+
+                       $params = array(
+                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
+                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
+                               'query' => phpgw::get_var('query'),
+                               'sort'  => phpgw::get_var('sort'),
+                               'dir'   => phpgw::get_var('dir'),
+                               'filters' => $filters
+                       );
+
+                       $applications = $this->bo->so->read($params);
+
+                       foreach($applications['results'] as &$application)
+                       {
+                               if (strstr($application['building_name'],"%"))
+                               {
+                                       $search = array('%2C','%C3%85', 
'%C3%A5', '%C3%98', '%C3%B8', '%C3%86', '%C3%A6');
+                                       $replace = array 
(',','Å','å','Ø','ø','Æ','æ');
+                                       $application['building_name'] = 
str_replace($search, $replace, $application['building_name']);
+                               }
+
+                               $application['status'] = 
lang($application['status']);
+                               $application['created'] = 
pretty_timestamp($application['created']);
+                               $application['modified'] = 
pretty_timestamp($application['modified']);
+                               $application['frontend_modified'] = 
pretty_timestamp($application['frontend_modified']);
+                               $application['resources'] = 
$this->resource_bo->so->read(array('filters'=>array('id'=>$application['resources'])));
+                               $application['resources'] = 
$application['resources']['results'];
+                               if($application['resources'])
+                               {
+                                       $names = array();
+                                       foreach($application['resources'] as 
$res)
+                                       {
+                                               $names[] = $res['name'];
+                                       }
+                                       $application['what'] = 
$application['resources'][0]['building_name']. ' ('.join(', ', $names).')';
+                               }
+                       }
+                       array_walk($applications["results"], array($this, 
"_add_links"), "controller.uicontrol_item2.index");
+
+                       return $this->yui_results($applications);
+               }       */      
                
                public function edit()
                {
@@ -217,7 +374,7 @@
                        $query_type = phpgw::get_var('type');
                        switch($query_type)
                        {
-                               case 'all_procedures': // ... all composites, 
filters (active and vacant)
+                               default: // ... all composites, filters (active 
and vacant)
                                        
phpgwapi_cache::session_set('controller', 'procedure_query', $search_for);
                                        $filters = array();
                                        $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);




reply via email to

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