[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8375]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8375] |
Date: |
Tue, 20 Dec 2011 07:45:20 +0000 |
Revision: 8375
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8375
Author: vator
Date: 2011-12-20 07:45:20 +0000 (Tue, 20 Dec 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.socheck_item.inc.php
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/class.uicheck_list_for_location.inc.php
trunk/controller/inc/component/class.calendar_builder.inc.php
trunk/controller/inc/component/class.date_generator.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/js/controller/custom_ui.js
Added Paths:
-----------
trunk/controller/inc/class.uicalendar.inc.php
Removed Paths:
-------------
trunk/controller/inc/class.uilocation_check_list.inc.php
Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php 2011-12-20 07:45:04 UTC
(rev 8374)
+++ trunk/controller/inc/class.socheck_item.inc.php 2011-12-20 07:45:20 UTC
(rev 8375)
@@ -99,7 +99,7 @@
public function get_single($check_item_id)
{
- $sql = "SELECT ci.*, coi.id as coi_id, coi.* ";
+ $sql = "SELECT ci.*, ci.id as c_id, coi.id as coi_id,
coi.* ";
$sql .= "FROM controller_check_item ci,
controller_control_item coi ";
$sql .= "WHERE ci.id = $check_item_id ";
$sql .= "AND ci.control_item_id=coi.id";
@@ -107,11 +107,11 @@
$this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
if($this->db->next_record()) {
- $check_item = new
controller_check_item($this->unmarshal($this->db->f('id', true), 'int'));
-
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
+ $check_item = new
controller_check_item($this->unmarshal($this->db->f('c_id', true), 'int'));
$check_item->set_status($this->unmarshal($this->db->f('status', true), 'bool'));
$check_item->set_comment($this->unmarshal($this->db->f('comment', true),
'string'));
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id',
true), 'int'));
+
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
$control_item = new
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
$control_item->set_title($this->db->f('title',
true), 'string');
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2011-12-20 07:45:04 UTC
(rev 8374)
+++ trunk/controller/inc/class.socheck_list.inc.php 2011-12-20 07:45:20 UTC
(rev 8375)
@@ -51,7 +51,7 @@
}
public function get_single($check_list_id){
- $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, ci.id as ci_id, ci.status as ci_status,
control_item_id, ci.comment as ci_comment, check_list_id FROM
controller_check_list cl, controller_check_item ci WHERE cl.id = $check_list_id
AND cl.id = ci.check_list_id;";
+ $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.control_id, cl.comment as cl_comment, deadline, ci.id as ci_id, ci.status as
ci_status, control_item_id, ci.comment as ci_comment, check_list_id FROM
controller_check_list cl, controller_check_item ci WHERE cl.id = $check_list_id
AND cl.id = ci.check_list_id;";
$this->db->query($sql);
$counter = 0;
@@ -60,6 +60,7 @@
if($counter == 0){
$check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+
$check_list->set_control_id($this->unmarshal($this->db->f('control_id', true),
'int'));
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'bool'));
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
@@ -84,15 +85,18 @@
}
}
- public function get_single_with_check_items($check_list_id){
- $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, completed_date, ";
+ public function get_single_with_check_items($check_list_id, $status){
+ $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.control_id, cl.comment as cl_comment, deadline, planned_date,
completed_date, ";
$sql .= "ci.id as ci_id, ci.status as ci_status,
control_item_id, ci.comment as ci_comment, check_list_id, ";
$sql .= "coi.title as coi_id, coi.title as coi_title,
coi.required as coi_required, coi.required as coi_required, ";
$sql .= "coi.what_to_do as coi_what_to_do, coi.how_to_do as
coi_how_to_do, coi.control_group_id as coi_control_group_id ";
$sql .= "FROM controller_check_list cl ";
$sql .= "LEFT JOIN controller_check_item as ci ON cl.id =
ci.check_list_id ";
$sql .= "LEFT JOIN controller_control_item as coi ON
ci.control_item_id=coi.id ";
- $sql .= "WHERE cl.id = $check_list_id;";
+ $sql .= "WHERE cl.id = $check_list_id";
+
+ if($status == 'open')
+ $sql .= "AND ci.status = 0";
$this->db->query($sql);
@@ -104,6 +108,7 @@
if($counter == 0){
$check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'bool'));
+
$check_list->set_control_id($this->unmarshal($this->db->f('control_id', true),
'int'));
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date',
true), 'int'));
@@ -237,6 +242,7 @@
$sql .= "AND c.repeat_type < 2 ";
$sql .= "AND cl.control_id = c.id ";
$sql .= "AND cl.id = ci.check_list_id ";
+ $sql .= "AND ci.status = 0 ";
$sql .= "AND deadline BETWEEN $from_date AND $to_date ";
$sql .= "GROUP BY c.id, title, start_date, end_date, cl.id,
cl.deadline, c.repeat_type, c.repeat_interval ";
$sql .= "ORDER BY c.id";
@@ -255,12 +261,12 @@
}
$control_array = array(
-
"id" => $this->unmarshal($this->db->f('c_id', true),
'int'),
-
"title" => $this->unmarshal($this->db->f('title', true),
'string'),
-
"repeat_type" => $this->unmarshal($this->db->f('repeat_type', true), 'int'),
-
"repeat_interval" => $this->unmarshal($this->db->f('repeat_interval', true),
'int'),
-
"start_date" => $this->unmarshal($this->db->f('start_date', true), 'int'),
-
"end_date" => $this->unmarshal($this->db->f('end_date', true), 'int')
+
"id" => $this->unmarshal($this->db->f('c_id', true),
'int'),
+
"title" => $this->unmarshal($this->db->f('title',
true), 'string'),
+
"repeat_type" => $this->unmarshal($this->db->f('repeat_type', true),
'int'),
+
"repeat_interval" => $this->unmarshal($this->db->f('repeat_interval',
true), 'int'),
+
"start_date" => $this->unmarshal($this->db->f('start_date', true),
'int'),
+
"end_date" => $this->unmarshal($this->db->f('end_date',
true), 'int')
);
}
@@ -455,7 +461,6 @@
'planned_date',
'completed_date',
'location_code',
- 'equipment_id'
);
$values = array(
@@ -466,7 +471,7 @@
$this->marshal($check_list->get_planned_date(), 'int'),
$this->marshal($check_list->get_completed_date(),
'int'),
$this->marshal($check_list->get_location_code(), 'int'),
- $this->marshal($check_list->get_equipment_id(), 'int')
+// $this->marshal($check_list->get_equipment_id(), 'int')
);
$result = $this->db->query('INSERT INTO controller_check_list
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')',
__LINE__,__FILE__);
Copied: trunk/controller/inc/class.uicalendar.inc.php (from rev 8347,
trunk/controller/inc/class.uilocation_check_list.inc.php)
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php
(rev 0)
+++ trunk/controller/inc/class.uicalendar.inc.php 2011-12-20 07:45:20 UTC
(rev 8375)
@@ -0,0 +1,413 @@
+<?php
+/**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erik 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$
+ */
+
+ phpgw::import_class('controller.uicommon');
+ phpgw::import_class('controller.socheck_list');
+
+ include_class('controller', 'check_list', 'inc/model/');
+ include_class('controller', 'check_item', 'inc/model/');
+ include_class('controller', 'check_list_status_info', 'inc/helper/');
+ include_class('controller', 'calendar_builder', 'inc/component/');
+
+ class controller_uilocation_check_list extends controller_uicommon
+ {
+ private $so;
+ private $so_control;
+ private $so_control_group;
+ private $so_control_group_list;
+ private $so_control_item;
+ private $so_check_list;
+ private $so_check_item;
+ private $calendar_builder;
+
+ public $public_functions = array
+ (
+ 'index' => true,
+ 'view_check_lists_for_control' => true,
+ 'save_check_list'
=> true,
+ 'view_check_list'
=> true,
+ 'edit_check_list'
=> true,
+ 'save_check_items'
=> true,
+ 'view_check_lists_for_location' => true,
+ 'view_calendar_for_month' =>
true,
+ 'view_calendar_for_year' =>
true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->so = CreateObject('controller.socheck_list');
+ $this->so_control =
CreateObject('controller.socontrol');
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
+ $this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so_check_list =
CreateObject('controller.socheck_list');
+ $this->so_check_item =
CreateObject('controller.socheck_item');
+
+
self::set_active_menu('controller::location_check_list');
+ }
+
+ public function view_calendar_for_month()
+ {
+ $location_code = phpgw::get_var('location_code');
+ $year = phpgw::get_var('year');
+ $month = phpgw::get_var('month');
+
+ $year = intval( $year );
+ $from_month = intval( $month );
+
+ $from_date = strtotime("$from_month/01/$year");
+ $to_month = $from_month + 1;
+ $to_date = strtotime("$to_month/01/$year+1");
+
+ if(empty($location_code)){
+ $location_code = "1101";
+ }
+
+ $this->calendar_builder = new
calendar_builder($from_date, $to_date);
+
+ $repeat_type = 0;
+ $check_list_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date,
$repeat_type);
+ $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $check_list_array, null, 31,
"view_days" );
+
+ print_r( $controls_calendar_array );
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ for($i=1;$i<=31;$i++){
+ $heading_array[$i] = "$i";
+ }
+
+ $data = array
+ (
+ 'location_array' =>
$location_array,
+ 'heading_array' =>
$heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'date_format' =>
$date_format,
+ 'period' =>
$month,
+ 'year' =>
$year
+ );
+
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
+
+ self::render_template_xsl('view_calendar_month', $data);
+ }
+
+ public function view_calendar_for_year()
+ {
+ $location_code = phpgw::get_var('location_code');
+ $year = phpgw::get_var('year');
+
+ $year = intval($year);
+
+ $from_date = strtotime("01/01/$year");
+ $to_year = $year + 1;
+ $to_date = strtotime("01/01/$to_year");
+
+ if(empty($location_code)){
+ $location_code = "1101";
+ }
+
+ $this->calendar_builder = new
calendar_builder($from_date, $to_date);
+
+ // Gets an array of controls that contains check_lists
for the specified location
+ $agg_check_list_array =
$this->so->get_agg_check_lists_for_location( $location_code, $from_date,
$to_date );
+ $controls_calendar_array =
$this->calendar_builder->build_agg_calendar_array( $agg_check_list_array );
+
+ $repeat_type = 2;
+ $control_check_list_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date,
$repeat_type );
+ $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $control_check_list_array,
$controls_calendar_array, 12, "view_months" );
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $heading_array = array("Jan", "Feb", "Mar", "Apr",
"Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des");
+
+ $data = array
+ (
+ 'location_array' =>
$location_array,
+ 'heading_array' =>
$heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'date_format' =>
$date_format,
+ 'period' =>
$year,
+ 'year' =>
$year
+ );
+
+ self::render_template_xsl('view_calendar_year', $data);
+
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
+ }
+
+
+ public function view_check_lists_for_location()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $control = $this->so_control->get_single($control_id);
+
+ $location_code = "1101";
+
+ $from_date = strtotime("01/01/2011");
+ $num_days_in_dec = cal_days_in_month(CAL_GREGORIAN, 12,
2011);
+ $to_date = strtotime("12/$num_days_in_dec/2011");
+
+ // Gets an array of controls that contains check_lists
for the specified location
+ $control_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date );
+
+ $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $control_array, $from_date,
$to_date );
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $data = array
+ (
+ 'location_array' =>
$location_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'date_format' =>
$date_format,
+ 'from_date' => $from_date,
+ 'to_date' =>
$to_date
+ );
+
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
+
self::render_template_xsl('view_check_lists_for_location', $data);
+ }
+
+ public function view_check_lists_for_control()
+ {
+ $control_id = phpgw::get_var('id');
+ $control = $this->so_control->get_single($control_id);
+
+ $date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $check_list_array =
$this->so->get_check_lists_for_control( $control_id );
+
+ $data = array
+ (
+ 'control_as_array' => $control->toArray(),
+ 'check_list_array' => $check_list_array,
+ 'date_format' => $date_format
+ );
+
+ self::render_template_xsl('view_check_lists', $data);
+ }
+
+ public function view_control_items_for_control()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $control = $this->so_control->get_single($control_id);
+
+ $control_groups_array =
$this->so_control_group_list->get_control_groups_by_control_id( $control_id );
+
+ $saved_groups_with_items_array = array();
+
+ foreach ($control_groups_array as $control_group)
+ {
+ $control_group_id = $control_group->get_id();
+ $saved_control_items =
$this->so_control_item->get_control_items_by_control_id_and_group($control_id,
$control_group_id);
+
+ $saved_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
+ }
+
+ $data = array
+ (
+ 'control_as_array'
=> $control->toArray(),
+ 'saved_groups_with_items_array' =>
$saved_groups_with_items_array
+ );
+
+ self::render_template_xsl('view_check_list', $data);
+ }
+
+ public function save_check_items(){
+ $check_item_ids = phpgw::get_var('check_item_ids');
+ $check_list_id = phpgw::get_var('check_list_id');
+
+ foreach($check_item_ids as $check_item_id){
+ $status = phpgw::get_var('status_' .
$check_item_id);
+ $comment = phpgw::get_var('comment_' .
$check_item_id);
+
+ $check_item =
$this->so_check_item->get_single($check_item_id);
+
+ $check_item->set_status( $status );
+ $check_item->set_comment( $comment );
+
+ $this->so_check_item->store( $check_item );
+ }
+
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list', 'check_list_id'=>$check_list_id));
+ }
+
+ public function save_check_list(){
+ $control_id = phpgw::get_var('control_id');
+ $control = $this->so_control->get_single($control_id);
+
+ $start_date = $control->get_start_date();
+ $end_date = $control->get_end_date();
+ $repeat_type = $control->get_repeat_type();
+ $repeat_interval = $control->get_repeat_interval();
+
+ $status = true;
+ $comment = "Kommentar for sjekkliste";
+ $deadline = $start_date;
+
+ // Saving check_list
+ $new_check_list = new controller_check_list();
+ $new_check_list->set_control_id( $control_id );
+ $new_check_list->set_status( $status );
+ $new_check_list->set_comment( $comment );
+ $new_check_list->set_deadline( $deadline );
+
+ $check_list_id = $this->so_check_list->store(
$new_check_list );
+
+ $control_items_list =
$this->so_control_item->get_control_items_by_control_id($control_id);
+
+ foreach($control_items_list as $control_item){
+
+ $status = true;
+ $comment = "Kommentar for sjekk item";
+
+ // Saving check_items for a list
+ $new_check_item = new controller_check_item();
+ $new_check_item->set_check_list_id(
$check_list_id );
+
+ $new_check_item->set_control_item_id(
$control_item->get_id() );
+ $new_check_item->set_status( $status );
+ $new_check_item->set_comment( $comment );
+
+ $saved_check_item =
$this->so_check_item->store( $new_check_item );
+ }
+
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list_for_control',
'control_id'=>$control_id));
+ }
+
+ public function make_check_list_for_control(){
+ $control_id = phpgw::get_var('control_id');
+ $control = $this->so_control->get_single($control_id);
+
+ $start_date = $control->get_start_date();
+ $end_date = $control->get_end_date();
+ $repeat_type = $control->get_repeat_type();
+ $repeat_interval = $control->get_repeat_interval();
+
+ $status = true;
+ $comment = "Kommentar for sjekkliste";
+ $deadline = $start_date;
+
+ // Saving check_list
+ $new_check_list = new controller_check_list();
+ $new_check_list->set_control_id( $control_id );
+ $new_check_list->set_status( $status );
+ $new_check_list->set_comment( $comment );
+ $new_check_list->set_deadline( $deadline );
+
+ $check_list_id = $this->so_check_list->store(
$new_check_list );
+
+ $control_items_list =
$this->so_control_item->get_control_items_by_control_id($control_id);
+
+ foreach($control_items_list as $control_item){
+
+ $status = true;
+ $comment = "Kommentar for sjekk item";
+
+ // Saving check_items for a list
+ $new_check_item = new controller_check_item();
+ $new_check_item->set_check_list_id(
$check_list_id );
+
+ $new_check_item->set_control_item_id(
$control_item->get_id() );
+ $new_check_item->set_status( $status );
+ $new_check_item->set_comment( $comment );
+
+ $saved_check_item =
$this->so_check_item->store( $new_check_item );
+ }
+
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list_for_control',
'control_id'=>$control_id));
+ }
+
+ public function query()
+ {
+ $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
+ );
+
+ $search_for = phpgw::get_var('query');
+
+
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else {
+ $user_rows_per_page = 10;
+ }
+
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
+ $sort_field = phpgw::get_var('sort');
+ if($sort_field == null)
+ {
+ $sort_field = 'control_id';
+ }
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
+ //Create an empty result set
+ $records = array();
+
+ //Retrieve a contract identifier and load corresponding
contract
+/* $control_id = phpgw::get_var('control_id');
+ if(isset($control_id))
+ {
+ $control = $this->so->get_single($control_id);
+ }
+*/
+ $result_objects = $this->so->get($start_index,
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type,
$filters);
+ $object_count = $this->so->get_count($search_for,
$search_type, $filters);
+ //var_dump($result_objects);
+
+ $results = array();
+
+ foreach($result_objects as $check_list_obj)
+ {
+ $results['results'][] =
$check_list_obj->serialize();
+ }
+
+ $results['total_records'] = $object_count;
+ $results['start'] = $params['start'];
+ $results['sort'] = $params['sort'];
+ $results['dir'] = $params['dir'];
+
+ array_walk($results["results"], array($this,
"_add_links"), "controller.uicheck_list.view_check_lists_for_control");
+
+ return $this->yui_results($results);
+ }
+ }
\ No newline at end of file
Property changes on: trunk/controller/inc/class.uicalendar.inc.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author Id
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2011-12-20 07:45:04 UTC
(rev 8374)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2011-12-20 07:45:20 UTC
(rev 8375)
@@ -52,8 +52,10 @@
'view_check_list'
=> true,
'edit_check_list'
=> true,
'save_check_items'
=> true,
+ 'save_check_item'
=> true,
'get_check_list_info' =>
true,
- 'control_calendar_status_overview' => true
+ 'control_calendar_status_overview' => true,
+ 'add_check_item_to_list' =>
true
);
public function __construct()
@@ -192,7 +194,7 @@
public function get_check_list_info()
{
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_check_items($check_list_id);
+ $check_list =
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
return json_encode( $check_list );
}
@@ -296,7 +298,49 @@
$this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list', 'check_list_id'=>$check_list_id));
}
+
+ public function save_check_item(){
+ $check_item_id = phpgw::get_var('check_item_id');
+ $comment = phpgw::get_var('comment');
+ $status = phpgw::get_var('status');
+
+ $check_item =
$this->so_check_item->get_single($check_item_id);
+ $check_item->set_status( $status );
+ $check_item->set_comment( $comment );
+
+ $check_item_id = $this->so_check_item->store(
$check_item );
+ if($status == 0)
+ $status_text = "not_fixed";
+ else
+ $status_text = "fixed";
+
+ if($check_item_id > 0)
+ return json_encode( array( "saveStatus" =>
"saved", "fixedStatus" => $status_text ) );
+ else
+ return json_encode( array( "status" =>
"not_saved" ) );
+ }
+
+ public function add_check_item_to_list(){
+ $control_item_id = phpgw::get_var('control_item_id');
+ $check_list_id = phpgw::get_var('check_list_id');
+ $comment = phpgw::get_var('comment');
+ $status = phpgw::get_var('status');
+
+ $check_item_obj = new controller_check_item();
+ $check_item_obj->set_status($status);
+ $check_item_obj->set_comment($comment);
+ $check_item_obj->set_check_list_id($check_list_id);
+ $check_item_obj->set_control_item_id($control_item_id);
+
+ $check_item_id = $this->so_check_item->store(
$check_item_obj );
+
+ if($check_item_id > 0)
+ return json_encode( array( "saveStatus" =>
"saved" ) );
+ else
+ return json_encode( array( "status" =>
"not_saved" ) );
+ }
+
public function save_check_list(){
$control_id = phpgw::get_var('control_id');
$control = $this->so_control->get_single($control_id);
Modified: trunk/controller/inc/class.uicheck_list_for_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list_for_location.inc.php
2011-12-20 07:45:04 UTC (rev 8374)
+++ trunk/controller/inc/class.uicheck_list_for_location.inc.php
2011-12-20 07:45:20 UTC (rev 8375)
@@ -50,6 +50,7 @@
private $so_control_area;
private $so_control;
private $so_check_list;
+ private $so_control_item;
var $public_functions = array(
'index' => true,
@@ -69,6 +70,7 @@
$this->so_control_area =
CreateObject('controller.socontrol_area');
$this->so_control =
CreateObject('controller.socontrol');
$this->so_check_list =
CreateObject('controller.socheck_list');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
$this->type_id =
$this->bo->type_id;
@@ -341,12 +343,13 @@
(
'location_array' => $location_array,
'control_array' => $control->toArray(),
- 'calendar_array' => $calendar_array,
+ 'deadline' =>
$calendar_array[0],
'date_format' => $date_format
);
self::add_javascript('controller', 'controller',
'jquery.js');
self::add_javascript('controller', 'controller',
'custom_ui.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
self::add_javascript('controller', 'controller',
'jquery-ui.custom.min.js');
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
@@ -357,19 +360,39 @@
function edit_check_list_for_location(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_check_items($check_list_id);
-
+ $check_list_with_check_items =
$this->so_check_list->get_single_with_check_items($check_list_id);
+
+ $control_item_list_all =
$this->so_control_item->get_control_items_by_control_id($check_list_with_check_items["control_id"]);
+
+ $control_item_ids = array();
+
foreach($check_list_with_check_items["check_item_array"] as $check_item){
+ $control_item_ids[] =
$check_item["control_item_id"];
+ }
+
+ $control_item_list_stripped = array();
+
+ foreach($control_item_list_all as $control_item){
+
+ if( !in_array($control_item->get_id(),
$control_item_ids) ){
+ $control_item_list_stripped[] =
$control_item->toArray();
+ }
+ }
+
$date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ print_r($control_item_list_stripped);
+
$data = array
(
- 'check_list' => $check_list,
- 'date_format' => $date_format
+ 'check_list' =>
$check_list_with_check_items,
+ 'control_items_list' =>
$control_item_list_stripped,
+ 'date_format' => $date_format
);
self::add_javascript('controller', 'controller',
'jquery.js');
self::add_javascript('controller', 'controller',
'jquery-ui.custom.min.js');
self::add_javascript('controller', 'controller',
'custom_ui.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
@@ -380,10 +403,22 @@
$location_code = phpgw::get_var('location_code');
$control_id = phpgw::get_var('control_id');
$status = phpgw::get_var('status');
- $planned_date = strtotime(
phpgw::get_var('planned_date', 'string') );
+
+ $planned_date = phpgw::get_var('planned_date',
'string');
$completed_date = strtotime(
phpgw::get_var('completed_date', 'string') );
$deadline_date = strtotime(
phpgw::get_var('deadline_date', 'string') );
-
+
+ $pos_day = strpos($planned_date, "/");
+ $day = substr($planned_date, 0, $pos_day);
+
+ $pos_month = strpos($planned_date, "-");
+ $len_month = $pos_month - $pos_day -1;
+ $month = substr($planned_date, $pos_day+1, $len_month);
+
+ $year = substr($planned_date, $pos_month +
$len_month-1, strlen($planned_date)-1);
+
+ $planned_date = mktime(0, 0, 0, $month, $day, $year);
+
$check_list = new controller_check_list();
$check_list->set_location_code($location_code);
$check_list->set_control_id($control_id);
@@ -391,11 +426,11 @@
$check_list->set_deadline( $deadline_date );
$check_list->set_planned_date($planned_date);
$check_list->set_completed_date($completed_date);
- $check_list->set_equipment_id($equipment_id);
+
+
+ $check_list_id =
$this->so_check_list->add($check_list);
- $this->so_check_list->add($check_list);
-
- $this->redirect(array('menuaction' =>
'controller.uilocation_check_list.view_calendar', 'year'=>2011, 'month'=>10));
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list_for_location.edit_check_list_for_location',
'check_list_id'=>$check_list_id));
}
public function query(){
Deleted: trunk/controller/inc/class.uilocation_check_list.inc.php
===================================================================
--- trunk/controller/inc/class.uilocation_check_list.inc.php 2011-12-20
07:45:04 UTC (rev 8374)
+++ trunk/controller/inc/class.uilocation_check_list.inc.php 2011-12-20
07:45:20 UTC (rev 8375)
@@ -1,411 +0,0 @@
-<?php
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erik 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$
- */
-
- phpgw::import_class('controller.uicommon');
- phpgw::import_class('controller.socheck_list');
-
- include_class('controller', 'check_list', 'inc/model/');
- include_class('controller', 'check_item', 'inc/model/');
- include_class('controller', 'check_list_status_info', 'inc/helper/');
- include_class('controller', 'calendar_builder', 'inc/component/');
-
- class controller_uilocation_check_list extends controller_uicommon
- {
- private $so;
- private $so_control;
- private $so_control_group;
- private $so_control_group_list;
- private $so_control_item;
- private $so_check_list;
- private $so_check_item;
- private $calendar_builder;
-
- public $public_functions = array
- (
- 'index' => true,
- 'view_check_lists_for_control' => true,
- 'save_check_list'
=> true,
- 'view_check_list'
=> true,
- 'edit_check_list'
=> true,
- 'save_check_items'
=> true,
- 'view_check_lists_for_location' => true,
- 'view_calendar_for_month' =>
true,
- 'view_calendar_for_year' =>
true
- );
-
- public function __construct()
- {
- parent::__construct();
-
- $this->so = CreateObject('controller.socheck_list');
- $this->so_control =
CreateObject('controller.socontrol');
- $this->so_control_group =
CreateObject('controller.socontrol_group');
- $this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
- $this->so_control_item =
CreateObject('controller.socontrol_item');
- $this->so_check_list =
CreateObject('controller.socheck_list');
- $this->so_check_item =
CreateObject('controller.socheck_item');
-
-
self::set_active_menu('controller::location_check_list');
- }
-
- public function view_calendar_for_month()
- {
- $location_code = phpgw::get_var('location_code');
- $year = phpgw::get_var('year');
- $month = phpgw::get_var('month');
-
- $year = intval( $year );
- $from_month = intval( $month );
-
- $from_date = strtotime("$from_month/01/$year");
- $to_month = $from_month + 1;
- $to_date = strtotime("$to_month/01/$year+1");
-
- if(empty($location_code)){
- $location_code = "1101";
- }
-
- $this->calendar_builder = new
calendar_builder($from_date, $to_date);
-
- $repeat_type = 0;
- $check_list_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date,
$repeat_type);
- $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $check_list_array, null, 31,
"view_days" );
-
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
-
- for($i=1;$i<=31;$i++){
- $heading_array[$i] = "$i";
- }
-
- $data = array
- (
- 'location_array' =>
$location_array,
- 'heading_array' =>
$heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'date_format' =>
$date_format,
- 'period' =>
$month,
- 'year' =>
$year
- );
-
- self::add_javascript('controller', 'controller',
'jquery.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
-
- self::render_template_xsl('view_calendar_month', $data);
- }
-
- public function view_calendar_for_year()
- {
- $location_code = phpgw::get_var('location_code');
- $year = phpgw::get_var('year');
-
- $year = intval($year);
-
- $from_date = strtotime("01/01/$year");
- $to_year = $year + 1;
- $to_date = strtotime("01/01/$to_year");
-
- if(empty($location_code)){
- $location_code = "1101";
- }
-
- $this->calendar_builder = new
calendar_builder($from_date, $to_date);
-
- // Gets an array of controls that contains check_lists
for the specified location
- $agg_check_list_array =
$this->so->get_agg_check_lists_for_location( $location_code, $from_date,
$to_date );
- $controls_calendar_array =
$this->calendar_builder->build_agg_calendar_array( $agg_check_list_array );
-
- $repeat_type = 2;
- $control_check_list_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date,
$repeat_type );
- $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $control_check_list_array,
$controls_calendar_array, 12, "view_months" );
-
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
-
- $heading_array = array("Jan", "Feb", "Mar", "Apr",
"Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des");
-
- $data = array
- (
- 'location_array' =>
$location_array,
- 'heading_array' =>
$heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'date_format' =>
$date_format,
- 'period' =>
$year,
- 'year' =>
$year
- );
-
- self::render_template_xsl('view_calendar_year', $data);
-
- self::add_javascript('controller', 'controller',
'jquery.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
- }
-
-
- public function view_check_lists_for_location()
- {
- $control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
-
- $location_code = "1101";
-
- $from_date = strtotime("01/01/2011");
- $num_days_in_dec = cal_days_in_month(CAL_GREGORIAN, 12,
2011);
- $to_date = strtotime("12/$num_days_in_dec/2011");
-
- // Gets an array of controls that contains check_lists
for the specified location
- $control_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date );
-
- $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $control_array, $from_date,
$to_date );
-
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
-
- $data = array
- (
- 'location_array' =>
$location_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'date_format' =>
$date_format,
- 'from_date' => $from_date,
- 'to_date' =>
$to_date
- );
-
- self::add_javascript('controller', 'controller',
'jquery.js');
- self::add_javascript('controller', 'controller',
'ajax.js');
-
self::render_template_xsl('view_check_lists_for_location', $data);
- }
-
- public function view_check_lists_for_control()
- {
- $control_id = phpgw::get_var('id');
- $control = $this->so_control->get_single($control_id);
-
- $date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $check_list_array =
$this->so->get_check_lists_for_control( $control_id );
-
- $data = array
- (
- 'control_as_array' => $control->toArray(),
- 'check_list_array' => $check_list_array,
- 'date_format' => $date_format
- );
-
- self::render_template_xsl('view_check_lists', $data);
- }
-
- public function view_control_items_for_control()
- {
- $control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
-
- $control_groups_array =
$this->so_control_group_list->get_control_groups_by_control_id( $control_id );
-
- $saved_groups_with_items_array = array();
-
- foreach ($control_groups_array as $control_group)
- {
- $control_group_id = $control_group->get_id();
- $saved_control_items =
$this->so_control_item->get_control_items_by_control_id_and_group($control_id,
$control_group_id);
-
- $saved_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
- }
-
- $data = array
- (
- 'control_as_array'
=> $control->toArray(),
- 'saved_groups_with_items_array' =>
$saved_groups_with_items_array
- );
-
- self::render_template_xsl('view_check_list', $data);
- }
-
- public function save_check_items(){
- $check_item_ids = phpgw::get_var('check_item_ids');
- $check_list_id = phpgw::get_var('check_list_id');
-
- foreach($check_item_ids as $check_item_id){
- $status = phpgw::get_var('status_' .
$check_item_id);
- $comment = phpgw::get_var('comment_' .
$check_item_id);
-
- $check_item =
$this->so_check_item->get_single($check_item_id);
-
- $check_item->set_status( $status );
- $check_item->set_comment( $comment );
-
- $this->so_check_item->store( $check_item );
- }
-
- $this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list', 'check_list_id'=>$check_list_id));
- }
-
- public function save_check_list(){
- $control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
-
- $start_date = $control->get_start_date();
- $end_date = $control->get_end_date();
- $repeat_type = $control->get_repeat_type();
- $repeat_interval = $control->get_repeat_interval();
-
- $status = true;
- $comment = "Kommentar for sjekkliste";
- $deadline = $start_date;
-
- // Saving check_list
- $new_check_list = new controller_check_list();
- $new_check_list->set_control_id( $control_id );
- $new_check_list->set_status( $status );
- $new_check_list->set_comment( $comment );
- $new_check_list->set_deadline( $deadline );
-
- $check_list_id = $this->so_check_list->store(
$new_check_list );
-
- $control_items_list =
$this->so_control_item->get_control_items_by_control_id($control_id);
-
- foreach($control_items_list as $control_item){
-
- $status = true;
- $comment = "Kommentar for sjekk item";
-
- // Saving check_items for a list
- $new_check_item = new controller_check_item();
- $new_check_item->set_check_list_id(
$check_list_id );
-
- $new_check_item->set_control_item_id(
$control_item->get_id() );
- $new_check_item->set_status( $status );
- $new_check_item->set_comment( $comment );
-
- $saved_check_item =
$this->so_check_item->store( $new_check_item );
- }
-
- $this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list_for_control',
'control_id'=>$control_id));
- }
-
- public function make_check_list_for_control(){
- $control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
-
- $start_date = $control->get_start_date();
- $end_date = $control->get_end_date();
- $repeat_type = $control->get_repeat_type();
- $repeat_interval = $control->get_repeat_interval();
-
- $status = true;
- $comment = "Kommentar for sjekkliste";
- $deadline = $start_date;
-
- // Saving check_list
- $new_check_list = new controller_check_list();
- $new_check_list->set_control_id( $control_id );
- $new_check_list->set_status( $status );
- $new_check_list->set_comment( $comment );
- $new_check_list->set_deadline( $deadline );
-
- $check_list_id = $this->so_check_list->store(
$new_check_list );
-
- $control_items_list =
$this->so_control_item->get_control_items_by_control_id($control_id);
-
- foreach($control_items_list as $control_item){
-
- $status = true;
- $comment = "Kommentar for sjekk item";
-
- // Saving check_items for a list
- $new_check_item = new controller_check_item();
- $new_check_item->set_check_list_id(
$check_list_id );
-
- $new_check_item->set_control_item_id(
$control_item->get_id() );
- $new_check_item->set_status( $status );
- $new_check_item->set_comment( $comment );
-
- $saved_check_item =
$this->so_check_item->store( $new_check_item );
- }
-
- $this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list_for_control',
'control_id'=>$control_id));
- }
-
- public function query()
- {
- $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
- );
-
- $search_for = phpgw::get_var('query');
-
-
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
- {
- $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else {
- $user_rows_per_page = 10;
- }
-
- // YUI variables for paging and sorting
- $start_index = phpgw::get_var('startIndex', 'int');
- $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
- $sort_field = phpgw::get_var('sort');
- if($sort_field == null)
- {
- $sort_field = 'control_id';
- }
- $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
- //Create an empty result set
- $records = array();
-
- //Retrieve a contract identifier and load corresponding
contract
-/* $control_id = phpgw::get_var('control_id');
- if(isset($control_id))
- {
- $control = $this->so->get_single($control_id);
- }
-*/
- $result_objects = $this->so->get($start_index,
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type,
$filters);
- $object_count = $this->so->get_count($search_for,
$search_type, $filters);
- //var_dump($result_objects);
-
- $results = array();
-
- foreach($result_objects as $check_list_obj)
- {
- $results['results'][] =
$check_list_obj->serialize();
- }
-
- $results['total_records'] = $object_count;
- $results['start'] = $params['start'];
- $results['sort'] = $params['sort'];
- $results['dir'] = $params['dir'];
-
- array_walk($results["results"], array($this,
"_add_links"), "controller.uicheck_list.view_check_lists_for_control");
-
- return $this->yui_results($results);
- }
- }
\ No newline at end of file
Modified: trunk/controller/inc/component/class.calendar_builder.inc.php
===================================================================
--- trunk/controller/inc/component/class.calendar_builder.inc.php
2011-12-20 07:45:04 UTC (rev 8374)
+++ trunk/controller/inc/component/class.calendar_builder.inc.php
2011-12-20 07:45:20 UTC (rev 8375)
@@ -26,14 +26,17 @@
// Inserts dates on behalf of repeat type and repeat
interval
foreach($dates_array as $date){
+
+ $status = "control_registered";
+
if( $period_type == "view_months" )
{
- $calendar_array[ date("n", $date)
]["status"] = 0;
+ $calendar_array[ date("n", $date)
]["status"] = $status;
$calendar_array[ date("n", $date)
]["info"] = array("date" => $date, "control_id" => $control->get_id());
}
else if( $period_type == "view_days" )
{
- $calendar_array[ date("j", $date)
]["status"] = 0;
+ $calendar_array[ date("j", $date)
]["status"] = $status;
$calendar_array[ date("j", $date)
]["info"] = array("date" => $date, "control_id" => $control->get_id());
}
}
@@ -43,43 +46,35 @@
$check_list_status_info = new
check_list_status_info();
$check_list_status_info->set_id(
$check_list->get_id() );
- $check_list_status_info->set_status_text(
$check_list->get_status() );
-
- if( $check_list->get_status() == 0 ){
- $check_list_status_info->set_status(0);
- $status = 0;
- }
- else if( $check_list->get_status() == 1)
+
+ $todays_date = mktime(0,0,0,date("m"),
date("d"), date("Y"));
+
+ if( $check_list->get_status() == 0 &
$check_list->get_planned_date() > 0 )
{
- $check_list_status_info->set_status(1);
- $status = 1;
+ $status = "control_planned";
}
- else if( $check_list->get_status() == 2 &
$check_list->get_completed_date() < $check_list->get_deadline() )
+ else if( $check_list->get_status() == 0 &
$check_list->get_deadline() > $todays_date )
{
- $check_list_status_info->set_status(2);
- $status = 2;
+ $status = "control_not_accomplished";
}
- else if( $check_list->get_status() == 3 &
$check_list->get_completed_date() > $check_list->get_deadline() )
+ else if( $check_list->get_status() == 1 &
$check_list->get_completed_date() > $check_list->get_deadline() )
{
- $check_list_status_info->set_status(3);
- $status = 3;
+ $status =
"control_accomplished_over_time_without_errors";
}
- else if( $check_list->get_status() == 4 )
+ else if( $check_list->get_status() == 1 &
$check_list->get_completed_date() < $check_list->get_deadline() )
{
- $check_list_status_info->set_status(4);
- $status = 4;
+ $status =
"control_accomplished_in_time_without_errors";
}
- else if( $check_list->get_status() == 5 )
+ else if( $check_list->get_status() == 2 ){
+ $status =
"control_accomplished_with_errors";
+ }
+ else if( $check_list->get_status() == 3 )
{
- $check_list_status_info->set_status(5);
- $status = 5;
+ $status = "control_canceled";
}
$check_list_status_info->set_deadline(
date("d/m-Y", $check_list->get_deadline()) );
- echo " " . date("d/m-Y",
$check_list->get_deadline()) . " ";
- echo $check_list_status_info->get_id();
-
if($period_type == "view_months")
{
$calendar_array[ date("n",
$check_list->get_deadline()) ]["status"] = $status;
Modified: trunk/controller/inc/component/class.date_generator.inc.php
===================================================================
--- trunk/controller/inc/component/class.date_generator.inc.php 2011-12-20
07:45:04 UTC (rev 8374)
+++ trunk/controller/inc/component/class.date_generator.inc.php 2011-12-20
07:45:20 UTC (rev 8375)
@@ -29,10 +29,6 @@
$interval_date = $period_start_date;
- echo " Interval start date: " . date("d/m-Y", $interval_date);
- echo " Period end date: " . date("d/m-Y",
$this->period_end_date);
-
-
while($interval_date <= $this->period_end_date){
$this->calendar_array[] = $interval_date;
@@ -52,7 +48,6 @@
$num_days_in_month =
cal_days_in_month(CAL_GREGORIAN, $month, $year);
$interval_date = mktime(0,0,0, $month,
$num_days_in_month, $year);
- echo " Ny interval date: " . date("d/m-Y",
$interval_date);
}
else if($this->repeat_type == 3)
{
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2011-12-20 07:45:04 UTC (rev
8374)
+++ trunk/controller/js/controller/ajax.js 2011-12-20 07:45:20 UTC (rev
8375)
@@ -198,4 +198,68 @@
$(infoBox).hide();
});
+
+ // file: edit_check_list.xsl
+ $(".frm_save_check_item").submit(function(e){
+ e.preventDefault();
+ var thisForm = $(this);
+ var liWrp = $(this).parent();
+ var submitBnt = $(thisForm).find("input[type='submit']");
+ var requestUrl = $(thisForm).attr("action");
+
+ $.ajax({
+ type: 'POST',
+ url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
+ success: function(data) {
+ if(data){
+ var obj = jQuery.parseJSON(data);
+
+ if(obj.saveStatus == "saved" &
obj.fixedStatus == "fixed"){
+ $(liWrp).fadeOut('2000', function() {
+ $(liWrp).addClass("hidden");
+ });
+
+ }
+ else if(obj.saveStatus == "saved" &
obj.fixedStatus == "not_fixed"){
+
+ var submitBnt =
$(thisForm).find("input[type='submit']");
+ $(submitBnt).val("Lagret");
+
+ // Changes text on save button
back to original
+ window.setTimeout(function() {
+ $(submitBnt).val('Lagre
sjekkpunkt');
+
$(submitBnt).addClass("not_active");
+ }, 1000);
+ }
+ }
+ }
+ });
+ });
+
+ // file: edit_check_list.xsl
+ $(".frm_save_control_item").submit(function(e){
+ e.preventDefault();
+ var thisForm = $(this);
+ var liWrp = $(this).parent();
+ var submitBnt = $(thisForm).find("input[type='submit']");
+ var requestUrl = $(thisForm).attr("action");
+
+ $.ajax({
+ type: 'POST',
+ url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
+ success: function(data) {
+ if(data){
+ var obj = jQuery.parseJSON(data);
+
+ if(obj.saveStatus == "saved"){
+ $(liWrp).fadeOut('2000', function() {
+ $(liWrp).addClass("hidden");
+ });
+
+ }
+ }
+ }
+ });
+ });
+
});
\ No newline at end of file
Modified: trunk/controller/js/controller/custom_ui.js
===================================================================
--- trunk/controller/js/controller/custom_ui.js 2011-12-20 07:45:04 UTC (rev
8374)
+++ trunk/controller/js/controller/custom_ui.js 2011-12-20 07:45:20 UTC (rev
8375)
@@ -118,15 +118,11 @@
$("#frm_control_items").prepend("<input type='hidden'
id=hid_" + control_item_id + " name='control_tag_ids[]' value=" +
control_group_id + ":" + control_item_id + " />");
}
});
-});
-
-function slide_up(elem){
-
-}
-
-function slide_down(elem){
-
-
-}
+ $(".frm_save_check_item").click(function(e){
+ var thisForm = $(this);
+ var submitBnt = $(thisForm).find("input[type='submit']");
+ $(submitBnt).removeClass("not_active");
+ });
+});
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8375],
Torstein <=