[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8729]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8729] |
Date: |
Mon, 30 Jan 2012 18:25:47 +0000 |
Revision: 8729
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8729
Author: vator
Date: 2012-01-30 18:25:47 +0000 (Mon, 30 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.uicheck_list.inc.php
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2012-01-30 18:23:31 UTC
(rev 8728)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2012-01-30 18:25:47 UTC
(rev 8729)
@@ -27,63 +27,68 @@
* @subpackage controller
* @version $Id$
*/
-
+
+ phpgw::import_class('phpgwapi.yui');
phpgw::import_class('controller.uicommon');
+ phpgw::import_class('controller.socontrol_area');
phpgw::import_class('controller.socheck_list');
-
+
include_class('controller', 'check_list', 'inc/model/');
- include_class('controller', 'check_item', 'inc/model/');
+ include_class('controller', 'date_generator', 'inc/component/');
include_class('controller', 'status_checker', 'inc/helper/');
include_class('controller', 'date_helper', 'inc/helper/');
-
- class controller_uicheck_list extends controller_uicommon
+ include_class('controller', 'check_item', 'inc/model/');
+
+ class controller_uicheck_list_for_location extends controller_uicommon
{
private $so;
+ private $so_control_area;
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 $so_procedure;
+ private $so_control_group_list;
+ private $so_control_item_list;
+
+ var $public_functions = array(
+
'index' => true,
+
'add_check_list' => true,
+
'save_check_list' => true,
+
'edit_check_list' => true,
+
'create_case_message' => true,
+
'view_control_info' => true,
+
'view_cases_for_check_list' => true,
+
'update_check_list' => true,
+
'print_check_list' => true,
+
'register_case' => true,
+
'view_open_cases' => true,
+
'view_closed_cases' => true,
+
'view_measurements' => true,
+
'view_control_details' => true,
+
'view_control_items' => true,
+
'add_check_item_to_list' => true,
+
'save_check_items' => true,
+
'save_check_item' => true,
+
'get_check_list_info' => true,
+
'get_cases_for_check_list' => true
+ );
- 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,
- // 'save_check_item'
=> true,
- // 'get_check_list_info' =>
true,
- // 'control_calendar_status_overview' => true,
- // 'add_check_item_to_list' =>
true,
- // 'view_control_items' =>
true,
- //'view_control_details'
=> true,
- //'register_case'
=> true,
- //'view_open_cases'
=> true,
- //'view_closed_cases'
=> true,
- //'view_measurements'
=> true,
- // 'get_cases_for_check_list' =>
true
- );
-
- public function __construct()
+ 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_area =
CreateObject('controller.socontrol_area');
+ $this->so_control =
CreateObject('controller.socontrol');
+ $this->so =
CreateObject('controller.socheck_list');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so_check_item =
CreateObject('controller.socheck_item');
+ $this->so_procedure =
CreateObject('controller.soprocedure');
$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');
- $this->so_procedure =
CreateObject('controller.soprocedure');
+ $this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::check_list";
- }
-/*
+
self::set_active_menu('controller::control::check_list');
+ }
+
public function index()
{
if(phpgw::get_var('phpgw_return_as') == 'json') {
@@ -171,94 +176,264 @@
)
),
);
-//_debug_array($data);
self::render_template_xsl('datatable', $data);
}
- */
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- public function view_check_list()
- {
+
+ function add_check_list(){
+ $location_code = phpgw::get_var('location_code');
+ $control_id = phpgw::get_var('control_id');
+ $date = phpgw::get_var('date');
+
+ $control = $this->so_control->get_single($control_id);
+
+ if($date == null || $date == ''){
+ $todays_date = mktime(0,0,0, date("m"),
date("d"), date("Y"));
+ $period_start_date = $todays_date;
+
+ if( $control->get_repeat_type() == 1 )
+ {
+ $period_end_date = mktime(0,0,0,
date("m")+1, date("d"), date("Y"));
+ }else if( $control->get_repeat_type() == 2 )
+ {
+ $period_end_date = mktime(0,0,0,
date("m"), date("d"), date("Y") + 1);
+ }else if( $control->get_repeat_type() == 3 )
+ {
+ $period_end_date = mktime(0,0,0,
date("m"), date("d"), date("Y") + $control->get_repeat_interval());
+ }
+
+ $date_generator = new
date_generator($control->get_start_date(), $control->get_end_date(),
$period_start_date, $period_end_date, $control->get_repeat_type(),
$control->get_repeat_interval());
+
+ $calendar_array = $date_generator->get_dates();
+ }
+ else
+ {
+ $calendar_array[] = $date;
+ }
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $data = array
+ (
+ 'location_array' => $location_array,
+ 'control_array' => $control->toArray(),
+ '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');
+
+
self::render_template_xsl(array('check_list/check_list_tab_menu','check_list/add_check_list'),
$data);
+ }
+
+ function edit_check_list(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_control_items($check_list_id);
-
+
+ $check_list = $this->so->get_single($check_list_id);
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+
$date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
+ $location_code = $check_list->get_location_code();
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
$data = array
(
- 'check_list' => $check_list,
- 'date_format' => $date_format
+ 'control' =>
$control->toArray(),
+ 'check_list' =>
$check_list->toArray(),
+ 'location_array' => $location_array,
+ 'date_format' => $date_format
);
-
- self::render_template_xsl('view_check_list', $data);
+
+ 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');
+
+
self::render_template_xsl(array('check_list/check_list_tab_menu','check_list/edit_check_list'),
$data);
}
-
-
- // Returns check list info as JSON
- public function get_check_list_info()
- {
+
+ function view_cases_for_check_list(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
- return json_encode( $check_list );
+ $check_list = $this->so->get_single($check_list_id);
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+
+ $date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $location_code = $check_list->get_location_code();
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $data = array
+ (
+ 'control' =>
$control->toArray(),
+ 'check_list' =>
$check_list->toArray(),
+ 'location_array' => $location_array,
+ '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');
+
+
self::render_template_xsl(array('check_list/check_list_tab_menu',
'check_list/view_cases_for_check_list'), $data);
}
- public function get_cases_for_check_list()
- {
- $check_list_id = phpgw::get_var('check_list_id');
+ function save_check_list(){
+ $location_code = phpgw::get_var('location_code');
+ $control_id = phpgw::get_var('control_id');
+ $status = (int)phpgw::get_var('status');
- $check_items_with_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, "open", null,
"return_array");
+ $deadline_date = phpgw::get_var('deadline_date',
'string');
+ $planned_date = phpgw::get_var('planned_date',
'string');
+ $completed_date = phpgw::get_var('completed_date',
'string');
- return json_encode( $check_items_with_cases );
+ $comment = phpgw::get_var('comment', 'string');
+
+ if($planned_date != '')
+ $planned_date_ts =
date_helper::get_timestamp_from_date( $planned_date, "d/m-Y" );
+
+ if($deadline_date != '')
+ $deadline_date_ts =
date_helper::get_timestamp_from_date( $deadline_date, "d/m-Y" );
+
+ if($completed_date != '')
+ $completed_date_ts =
date_helper::get_timestamp_from_date( $completed_date, "d/m-Y" );
+
+ $check_list = new controller_check_list();
+ $check_list->set_location_code($location_code);
+ $check_list->set_control_id($control_id);
+ $check_list->set_status($status);
+ $check_list->set_comment($comment);
+ $check_list->set_deadline( $deadline_date_ts );
+ $check_list->set_planned_date($planned_date_ts);
+ $check_list->set_completed_date($completed_date_ts);
+
+ $check_list_id = $this->so->store($check_list);
+
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list_for_location.edit_check_list',
'check_list_id'=>$check_list_id));
}
-
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- public function edit_check_list()
- {
+
+ function create_case_message(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_control_items($check_list_id);
-
+
+ $check_list_with_check_items =
$this->so->get_single_with_check_items($check_list_id);
+
+ $control_id =
$check_list_with_check_items["control_id"];
+ $control = $this->so_control->get_single( $control_id );
+
+ $location_code =
$check_list_with_check_items["location_code"];
+
$date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
$data = array
(
- 'check_list' => $check_list,
- 'date_format' => $date_format
+ 'location_array' =>
$location_array,
+ 'control_array' =>
$control->toArray(),
+ 'check_list' =>
$check_list_with_check_items,
+ 'date_format' => $date_format
);
-
- self::render_template_xsl('edit_check_list', $data);
+
+ 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');
+
+ self::render_template_xsl('create_case_messsage',
$data);
}
- */
-
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- public function control_calendar_status_overview()
- {
- $control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
+
+ public function view_control_info(){
+ $check_list_id = phpgw::get_var('check_list_id');
+
+ $check_list = $this->so->get_single($check_list_id);
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+
+ $cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' =>
$control_area_id,'globals' => true,'use_acl' => $this->_category_acl));
+ array_unshift($control_areas['cat_list'],array
('cat_id'=>'','name'=> lang('select value')));
+ $control_areas_array2 = array();
+
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_areas_array2[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
- $date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $check_list_array =
$this->so->get_check_lists_for_control( $control_id );
-
+ // Fetches prosedures that are related to first control
area in list
+ $control_area_id = $control_areas_array2[1]['id'];
+ $procedures_array =
$this->so_procedure->get_procedures_by_control_area($control_area_id);
+ $role_array = $this->so_control->get_roles();
+
+ $location_code = $check_list->get_location_code();
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
$data = array
(
- 'control_as_array' => $control->toArray(),
- 'check_list_array' => $check_list_array,
- 'date_format' => $date_format
+ 'location_array' =>
$location_array,
+ 'control' =>
$control->toArray(),
+ 'check_list' =>
$check_list->toArray(),
+ 'date_format' => $date_format,
+ 'control_areas_array2' => array('options' =>
$control_areas_array2),
+ 'procedures_array' =>
$procedures_array,
+ 'role_array' => $role_array
);
-
self::render_template_xsl('control_calendar_status_overview', $data);
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'jquery-ui.custom.min.js');
+
+
self::render_template_xsl(array('check_list/check_list_tab_menu','check_list/view_control_info'),
$data);
}
- */
- /*
- public function view_control_items(){
+ public function update_check_list(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single($check_list_id);
-
+ $status = (int)phpgw::get_var('status');
+ $comment = phpgw::get_var('comment');
+ $deadline_date = phpgw::get_var('deadline_date');
+ $completed_date = phpgw::get_var('completed_date');
+ $planned_date = phpgw::get_var('planned_date');
+
+ $planned_date_ts =
date_helper::get_timestamp_from_date( $planned_date, "d/m-Y" );
+ $completed_date_ts =
date_helper::get_timestamp_from_date( $completed_date, "d/m-Y" );
+
+ echo " comment: " . $comment;
+
+ // Fetches check_list from DB
+ $update_check_list =
$this->so->get_single($check_list_id);
+ $update_check_list->set_status( $status );
+ $update_check_list->set_comment( $comment );
+ $update_check_list->set_completed_date(
$completed_date_ts );
+ $update_check_list->set_planned_date( $planned_date_ts
);
+
+ $check_list_id = $this->so->update( $update_check_list
);
+
+ if($check_list_id > 0)
+ return json_encode( array( "saveStatus" =>
"updated" ) );
+ else
+ return json_encode( array( "saveStatus" =>
"not_updated" ) );
+ }
+
+ public function print_check_list(){
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list = $this->so->get_single($check_list_id);
+
$control =
$this->so_control->get_single($check_list->get_control_id());
$control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
@@ -280,10 +455,10 @@
'check_list'
=> $check_list->toArray()
);
-
self::render_template_xsl('check_list/view_control_items', $data);
+
self::render_template_xsl('check_list/print_check_list', $data);
}
- public function view_control_details(){
+ function view_control_details(){
$control_id = phpgw::get_var('control_id');
$control = $this->so_control->get_single($control_id);
@@ -317,11 +492,11 @@
self::render_template_xsl('check_list/view_control_details', $data);
}
-
+
function register_case(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single($check_list_id);
+ $check_list = $this->so->get_single($check_list_id);
$control =
$this->so_control->get_single($check_list->get_control_id());
// Fetches all control items for check list
@@ -363,7 +538,7 @@
function view_open_cases(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single($check_list_id);
+ $check_list = $this->so->get_single($check_list_id);
$open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, 'open', null,
'return_array');
@@ -379,7 +554,7 @@
function view_closed_cases(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single($check_list_id);
+ $check_list = $this->so->get_single($check_list_id);
$closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, 'closed',
null, 'return_array');
@@ -395,7 +570,7 @@
function view_measurements(){
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single($check_list_id);
+ $check_list = $this->so->get_single($check_list_id);
// Fetches check items that registeres measurement
$measurement_check_items =
$this->so_check_item->get_check_items($check_list_id, null,
'control_item_type_2', "return_array");
@@ -408,58 +583,61 @@
self::render_template_xsl(
array('check_list/cases_tab_menu', 'check_list/view_measurements'), $data );
}
-*/
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- 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 );
-
+
+ function view_control_items(){
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list = $this->so->get_single($check_list_id);
+
+ $control =
$this->so_control->get_single($check_list->get_control_id());
+ $control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
+
+ $saved_groups_with_items_array = array();
+
+ //Populating array with saved control items for each
group
+ foreach ($control_groups as $control_group)
+ {
+ $saved_control_items =
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
$control_group->get_id());
+
+ $control_item =
$this->so_control_item->get_single($control_item_id);
+
+ $saved_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
+ }
+
$data = array
(
- 'control_as_array' => $control->toArray(),
- 'check_list_array' => $check_list_array,
- 'date_format' => $date_format
+ 'saved_groups_with_items_array' =>
$saved_groups_with_items_array,
+ 'check_list'
=> $check_list->toArray()
);
-
- self::render_template_xsl('view_check_lists', $data);
+
+
self::render_template_xsl('check_list/view_control_items', $data);
}
- */
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- 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( $control_id );
+ 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 = (int)phpgw::get_var('status');
+ $type = phpgw::get_var('type');
- $saved_groups_with_items_array = array();
+ $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);
- foreach ($control_groups_array as $control_group)
- {
- $control_group_id = $control_group->get_id();
- $saved_control_items =
$this->so_control_item_list->get_control_items_by_control_and_group($control_id,
$control_group_id);
-
- $saved_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
+ if($type == 'control_item_type_2'){
+ $measurement = phpgw::get_var('measurement');
+ $check_item_obj->set_measurement($measurement);
}
+
+ $check_item_id = $this->so_check_item->store(
$check_item_obj );
- $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);
+ if($check_item_id > 0)
+ return json_encode( array( "saveStatus" =>
"saved" ) );
+ else
+ return json_encode( array( "saveStatus" =>
"not_saved" ) );
}
- */
- /*
+
public function save_check_items(){
$check_item_ids = phpgw::get_var('check_item_ids');
$check_list_id = phpgw::get_var('check_list_id');
@@ -476,7 +654,7 @@
$this->so_check_item->store( $check_item );
}
- $this->redirect(array('menuaction' =>
'controller.uicheck_list.view_check_list', 'check_list_id'=>$check_list_id));
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list_for_location.view_check_list',
'check_list_id'=>$check_list_id));
}
public function save_check_item(){
@@ -510,181 +688,23 @@
return json_encode( array( "status" =>
"not_saved" ) );
}
- public function add_check_item_to_list(){
- $control_item_id = phpgw::get_var('control_item_id');
+ // Returns check list info as JSON
+ public function get_check_list_info()
+ {
$check_list_id = phpgw::get_var('check_list_id');
- $comment = phpgw::get_var('comment');
- $status = (int)phpgw::get_var('status');
- $type = phpgw::get_var('type');
-
- $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);
-
- if($type == 'control_item_type_2'){
- $measurement = phpgw::get_var('measurement');
- $check_item_obj->set_measurement($measurement);
- }
+ $check_list =
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
- $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( "saveStatus" =>
"not_saved" ) );
+ return json_encode( $check_list );
}
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- public function save_check_list(){
- $control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
+ public function get_cases_for_check_list()
+ {
+ $check_list_id = phpgw::get_var('check_list_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();
-
-
- $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_list->get_control_items_by_control($control_id);
-
- foreach($control_items_list as $control_item){
-
- $status = 0;
- $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));
+ $check_items_with_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, "open", null,
"return_array");
+
+ return json_encode( $check_items_with_cases );
}
- */
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- 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_list->get_control_items_by_control($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
+ public function query(){}
+ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8729],
Torstein <=