fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10072] Controller: Restore deleted files


From: Torstein
Subject: [Fmsystem-commits] [10072] Controller: Restore deleted files
Date: Mon, 01 Oct 2012 13:08:29 +0000

Revision: 10072
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10072
Author:   vator
Date:     2012-10-01 13:08:28 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
Controller: Restore deleted files

Added Paths:
-----------
    trunk/controller/inc/helper/class.check_list_status_updater.inc.php
    trunk/controller/inc/helper/class.location_finder.inc.php

Added: trunk/controller/inc/helper/class.check_list_status_updater.inc.php
===================================================================
--- trunk/controller/inc/helper/class.check_list_status_updater.inc.php         
                (rev 0)
+++ trunk/controller/inc/helper/class.check_list_status_updater.inc.php 
2012-10-01 13:08:28 UTC (rev 10072)
@@ -0,0 +1,46 @@
+<?php
+       phpgw::import_class('controller.socheck_list');
+       phpgw::import_class('controller.socheck_item');
+       
+       include_class('controller', 'check_list', 'inc/model/');
+       include_class('controller', 'check_item', 'inc/model/');
+
+       class check_list_status_updater {
+               
+               public function __construct()
+               {
+                       $this->so_check_list = 
CreateObject('controller.socheck_list');
+                       $this->so_check_item = 
CreateObject('controller.socheck_item');
+               }
+                       
+               public function update_check_list_status( $check_list_id )
+               {
+                       $check_list = $this->so_check_list->get_single( 
$check_list_id );
+               
+                       $check_items = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
$control_item_type = null, $status = null, $messageStatus = null, 
"return_object");
+               
+                       $num_open_cases = 0;
+                       $num_pending_cases = 0;
+                                       
+                       foreach($check_items as $check_item){
+                               foreach($check_item->get_cases_array() as 
$case){
+                                       
+                                       if($case->get_status() == 
controller_check_item_case::STATUS_OPEN){
+                                               $num_open_cases++;
+                                       }
+                                       
+                                       if($case->get_status() == 
controller_check_item_case::STATUS_PENDING){
+                                               $num_pending_cases++;
+                                       }
+                               }       
+                       }
+                       
+                       if($num_open_cases > 0)
+                               
$check_list->set_status(controller_check_list::STATUS_DONE);
+                               
+                       $check_list->set_num_open_cases($num_open_cases);
+                       $check_list->set_num_pending_cases($num_pending_cases);
+                       
+                       $this->so_check_list->store($check_list);
+               }
+}

Added: trunk/controller/inc/helper/class.location_finder.inc.php
===================================================================
--- trunk/controller/inc/helper/class.location_finder.inc.php                   
        (rev 0)
+++ trunk/controller/inc/helper/class.location_finder.inc.php   2012-10-01 
13:08:28 UTC (rev 10072)
@@ -0,0 +1,51 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.uicontrol_group.inc.php 8267 2011-12-11 12:27:18Z 
sigurdne $
+       */      
+
+       phpgw::import_class('property.solocation');
+
+       class location_finder
+       {
+               private $so;
+               
+               public function __construct()
+               {
+                       $this->so = CreateObject('property.solocation');
+               }
+
+               function get_responsibilities($data = array())
+               {
+                       $data['filter_role_on_contact'] = 
$GLOBALS['phpgw']->accounts->get($data['user_id'])->person_id;
+                       $locations = $this->so->read($data);
+                       
+                       $total_records = $this->so->total_records;
+                       
+                       return $locations;
+               }
+       }




reply via email to

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