[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8093] Added menu choice that displays controls for a
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8093] Added menu choice that displays controls for a location. |
Date: |
Mon, 14 Nov 2011 06:32:30 +0000 |
Revision: 8093
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8093
Author: vator
Date: 2011-11-14 06:32:22 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
Added menu choice that displays controls for a location.
Updated control.xsl. Procedure list is populated when control area is chosen.
Modified Paths:
--------------
trunk/controller/inc/class.menu.inc.php
trunk/controller/inc/class.socheck_item.inc.php
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.socommon.inc.php
trunk/controller/inc/class.soprocedure.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/class.uicontrol.inc.php
trunk/controller/inc/class.uicontrol_item.inc.php
trunk/controller/inc/class.uiprocedure.inc.php
trunk/controller/inc/model/class.check_list.inc.php
trunk/controller/inc/model/class.control.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/setup/phpgw_no.lang
trunk/controller/setup/setup.inc.php
trunk/controller/setup/tables_update.inc.php
trunk/controller/templates/base/control_groups.xsl
trunk/controller/templates/base/css/base.css
trunk/controller/templates/base/view_check_lists.xsl
Added Paths:
-----------
trunk/controller/inc/class.uilocation_check_list.inc.php
trunk/controller/inc/helper/class.check_list_status_info.inc.php
trunk/controller/templates/base/view_check_lists_for_location.xsl
Removed Paths:
-------------
trunk/controller/inc/class.uiexample.inc.php
trunk/controller/inc/helper/class.calender_cell.inc.php
trunk/controller/templates/base/control_items.xsl
Modified: trunk/controller/inc/class.menu.inc.php
===================================================================
--- trunk/controller/inc/class.menu.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
+++ trunk/controller/inc/class.menu.inc.php 2011-11-14 06:32:22 UTC (rev
8093)
@@ -52,7 +52,7 @@
'text' => lang('Check_list'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicheck_list.index') ),
'image' => array('property',
'location_1'),
- ),
+ )
);
}
else
@@ -65,6 +65,12 @@
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicheck_list.index') ),
'image' => array('property',
'location_1'),
),
+ 'location_check_list' => array
+ (
+ 'text' =>
lang('Check_list_location'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uilocation_check_list.view_check_lists_for_location') ),
+ 'image' => array('property', 'location_1'),
+ ),
);
}
Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.socheck_item.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -48,10 +48,10 @@
function update($check_item){
$id = $check_item->get_id();
-
+
$values = array(
'control_item_id = ' .
$this->marshal($check_item->get_control_item_id(), 'int'),
- 'status = ' . $this->marshal($check_item->get_status(),
'string'),
+ 'status = ' . $this->marshal($check_item->get_status(),
'bool'),
'comment = ' .
$this->marshal($check_item->get_comment(), 'string'),
'check_list_id = ' .
$this->marshal($check_item->get_check_list_id(), 'int')
);
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.socheck_list.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -53,17 +53,8 @@
return null;
}
}
-
-
- protected $id;
- protected $title;
- protected $required;
- protected $what_to_do;
- protected $how_to_do;
- protected $control_group_id;
-
- public function get_single_with_control_item($check_list_id){
+ public function get_single_with_control_items($check_list_id){
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, ";
$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, ";
@@ -155,7 +146,12 @@
}
function get_check_lists_for_control($control_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.control_id =
$control_id AND cl.id = ci.check_list_id ORDER BY cl.id;";
+ $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, ";
+ $sql .= "ci.id as ci_id, ci.status as ci_status,
control_item_id, ci.comment as ci_comment, check_list_id ";
+ $sql .= "FROM controller_check_list cl, controller_check_item
ci ";
+ $sql .= "WHERE cl.control_id = $control_id ";
+ $sql .= "AND cl.id = ci.check_list_id ";
+ $sql .= "ORDER BY cl.id;";
$this->db->query($sql);
$check_list_id = 0;
@@ -196,7 +192,70 @@
}else {
return null;
}
+ }
+
+ function get_check_lists_for_location($location_code){
+ $sql = "SELECT c.id as c_id, cl.id as cl_id, cl.status as
cl_status, cl.comment as cl_comment, deadline, planned_date, completed_date,
cl.location_code as cl_loc, c.* ";
+ $sql .= "FROM controller_check_list cl, controller_control c ";
+ $sql .= "WHERE cl.location_code = $location_code ";
+ $sql .= "AND cl.control_id = c.id ";
+ $sql .= "ORDER BY c.id;";
+ $this->db->query($sql);
+
+ $control_id = 0;
+ $control = null;
+ while ($this->db->next_record()) {
+
+ if( $this->db->f('c_id', true) != $control_id ){
+
+ if($control_id != 0){
+
$control->set_check_lists_array($check_lists_array);
+ $controls_array[] = $control;
+ }
+
+ $control = new
controller_control($this->unmarshal($this->db->f('c_id', true), 'int'));
+
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+
$control->set_description($this->unmarshal($this->db->f('description', true),
'boolean'));
+
$control->set_start_date($this->unmarshal($this->db->f('start_date', true),
'int'));
+
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true),
'int'));
+
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name',
true), 'string'));
+
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id',
true), 'int'));
+
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
true), 'int'));
+
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
true), 'int'));
+
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
+
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
+
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
true), 'int'));
+
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true),
'int'));
+
$control->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'int'));
+
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true),
'int'));
+
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval',
true), 'int'));
+
+ $check_lists_array = array();
+ }
+
+ $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),
'string'));
+
$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'));
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('cl_loc', true),
'int'));
+
+ $check_lists_array[] = $check_list;
+
+ $control_id = $control->get_id();
+ }
+
+ if($control != null){
+ $control->set_check_lists_array($check_lists_array);
+ $controls_array[] = $control;
+
+ return $controls_array;
+ }else {
+ return null;
+ }
}
function get_query(string $sort_field, boolean $ascending, string
$search_for, string $search_type, array $filters, boolean $return_count)
@@ -266,10 +325,11 @@
function populate(int $control_id, &$control)
{
- $start_date = date("d.m.Y", $this->db->f('start_date'));
- $end_date = date("d.m.Y", $this->db->f('end_date'));
+
if($control == null) {
+ $start_date = date("d.m.Y",
$this->db->f('start_date'));
+ $end_date = date("d.m.Y", $this->db->f('end_date'));
$control = new controller_control((int) $control_id);
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
@@ -317,5 +377,22 @@
function update($object){}
- function get_id_field_name(){}
+ function get_id_field_name($extended_info = false)
+ {
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' => 'control', // alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+
+ return $ret;
+ }
}
Modified: trunk/controller/inc/class.socommon.inc.php
===================================================================
--- trunk/controller/inc/class.socommon.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
+++ trunk/controller/inc/class.socommon.inc.php 2011-11-14 06:32:22 UTC (rev
8093)
@@ -42,6 +42,7 @@
{
return $this->db->db_addslashes($value);
}
+
return "'" . $this->db->db_addslashes($value) . "'";
}
Modified: trunk/controller/inc/class.soprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.soprocedure.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.soprocedure.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -135,6 +135,39 @@
return $procedure;
}
+ function get_procedures_by_control_area_id($control_area_id)
+ {
+ $results = array();
+
+ $sql = "SELECT * FROM controller_procedure WHERE
control_area_id=$control_area_id";
+ $this->db->query($sql);
+
+ while($this->db->next_record()) {
+ $procedure = new
controller_procedure($this->unmarshal($this->db->f('id', true), 'int'));
+
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true),
'string'));
+
$procedure->set_responsibility($this->unmarshal($this->db->f('responsibility',
true), 'string'));
+
$procedure->set_description($this->unmarshal($this->db->f('description', true),
'string'));
+
$procedure->set_reference($this->unmarshal($this->db->f('reference', true),
'string'));
+
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true),
'string'));
+
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
+
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'),
'int'));
+
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'),
'int'));
+
+ $procedures_array[] = $procedure->toArray();
+ }
+
+ if( count( $procedures_array ) > 0 ){
+ return $procedures_array;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
function get_procedures($start = 0, $results = 1000, $sort = null, $dir
= '', $query = null, $search_option = null, $filters = array())
{
$results = array();
@@ -177,7 +210,7 @@
//$sql = "SELECT * FROM controller_procedure WHERE $condition
$order";
- $condition = "WHERE end_date IS NULL";
+ //$condition = "WHERE end_date IS NULL";
$sql = "SELECT * FROM controller_procedure $condition $order";
$this->db->limit_query($sql, $start, __LINE__, __FILE__,
$limit);
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -19,10 +19,11 @@
(
'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_list' =>
true,
+ 'view_check_list' =>
true,
+ 'edit_check_list' =>
true,
+ 'save_check_items' =>
true,
+ 'get_check_list_info' => true
);
public function __construct()
@@ -157,6 +158,15 @@
self::render_template_xsl('view_check_list', $data);
}
+ // Returns check list info as JSON
+ public function get_check_list_info()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list =
$this->so_check_list->get_single_with_control_items($check_list_id);
+
+ return json_encode( $check_list );
+ }
+
public function edit_check_list()
{
$check_list_id = phpgw::get_var('check_list_id');
@@ -173,7 +183,7 @@
self::render_template_xsl('edit_check_list', $data);
}
- public function view_check_lists_for_control()
+ public function control_calendar_status_overview()
{
$control_id = phpgw::get_var('control_id');
$control = $this->so_control->get_single($control_id);
@@ -189,6 +199,26 @@
'date_format' => $date_format
);
+
self::render_template_xsl('control_calendar_status_overview', $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);
}
@@ -246,7 +276,7 @@
$repeat_type = $control->get_repeat_type();
$repeat_interval = $control->get_repeat_interval();
- $status = true;
+ $status = "FALSE";
$comment = "Kommentar for sjekkliste";
$deadline = $start_date;
@@ -263,7 +293,7 @@
foreach($control_items_list as $control_item){
- $status = true;
+ $status = 0;
$comment = "Kommentar for sjekk item";
// Saving check_items for a list
Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.uicontrol.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -201,6 +201,8 @@
);
self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
self::render_template_xsl(array('control_tabs',
'control'), $data);
$this->use_yui_editor(array('description'));
@@ -227,15 +229,16 @@
$this->redirect(array('menuaction' =>
'controller.uicontrol.view_control_groups', 'control_id'=>$control_id,
'control_area_id'=>$control->get_control_area_id(),
'control_title'=>$control_title));
}
- // Displays control groups based on which chosen control area
+ // Displays control groups based on previously chosen control
area
public function view_control_groups(){
$control_id = phpgw::get_var('control_id');
$control_area_id = phpgw::get_var('control_area_id');
$control_title = phpgw::get_var('control_title');
+ $control_group_ids =
phpgw::get_var('control_group_ids');
+
+ $control_area = $this->so_control_area->get_single(
$control_area_id );
- $control_area = $this->so_control_area->get_single(
$control_area_id );
-
$control_groups_as_array =
$this->so_control_group->get_control_groups_as_array($control_area->get_id(),
25);
$tabs = array(
@@ -266,7 +269,8 @@
'control_id' =>
$control_id,
'control_title' =>
$control_title,
'control_area' =>
$control_area->toArray(),
- 'control_groups' =>
$control_groups_as_array
+ 'control_groups' =>
$control_groups_as_array,
+ 'chosen_control_groups' =>
$control_group_ids
);
self::add_javascript('controller', 'yahoo',
'control_tabs.js');
@@ -452,7 +456,7 @@
$repeat_type = $control->get_repeat_type();
$repeat_interval = $control->get_repeat_interval();
- $status = false;
+ $status = FALSE;
$comment = "Kommentar for sjekkliste";
$deadline = $start_date;
@@ -469,7 +473,7 @@
foreach($control_items_list as $control_item){
- $status = true;
+ $status = '0';
$comment = "Kommentar for sjekk item";
// Saving check_items for a list
@@ -479,7 +483,7 @@
$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 );
}
Modified: trunk/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_item.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.uicontrol_item.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -303,17 +303,12 @@
'control_group' =>
array('options' => $control_group_options),
);
-
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_item');
-
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
$GLOBALS['phpgw']->richtext->generate_script();
-
-
- // $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'controller.item', 'controller' );
-
+
self::render_template_xsl('control_item',
$data);
}
}
Deleted: trunk/controller/inc/class.uiexample.inc.php
===================================================================
--- trunk/controller/inc/class.uiexample.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.uiexample.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -1,515 +0,0 @@
-<?php
- phpgw::import_class('controller.uicommon');
- phpgw::import_class('property.boevent');
- phpgw::import_class('controller.socontrol');
- phpgw::import_class('controller.socontrol_item');
- phpgw::import_class('controller.socontrol_group');
-
- include_class('controller', 'control', 'inc/model/');
-
- class controller_uiexample extends controller_uicommon
- {
- private $bo;
- private $so;
- private $so_proc;
-
- public $public_functions = array
- (
- 'index' => true,
- 'edit' => true,
- 'normal_tabs' => true,
- 'separate_tabs' => true,
- 'delete' => true,
- 'js_poll' => true
- );
-
- public function __construct()
- {
- parent::__construct();
- $this->so = CreateObject('controller.socontrol');
- $this->so_control_item =
CreateObject('controller.socontrol_item');
- $this->so_control_group =
CreateObject('controller.socontrol_group');
- $this->bo = CreateObject('property.boevent',true);
- }
-
- public function index()
- {
- self::set_active_menu('controller::example');
- if(phpgw::get_var('phpgw_return_as') == 'json') {
- return $this->index_json();
- }
- $this->bo = CreateObject('booking.boapplication');
- $GLOBALS['phpgw_info']['apps']['manual']['section'] =
'booking_manual';
- 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('New application'),
- 'href' =>
self::link(array('menuaction' => 'controller.uiexample.index'))
- ),
- array('type' =>
'filter',
- 'name' =>
'status',
- 'text' => lang('Status').':',
- 'list' => array(
- array(
- 'id' => 'none',
- 'name' => lang('Not selected')
- ),
- array(
- 'id' => 'NEW',
- 'name' => lang('NEW')
- ),
- array(
- 'id' => 'PENDING',
- 'name' => lang('PENDING')
- ),
- array(
- 'id' => 'REJECTED',
- 'name' => lang('REJECTED')
- ),
- array(
- 'id' => 'ACCEPTED',
- 'name' => lang('ACCEPTED')
- )
- )
- ),
- array('type' =>
'filter',
- 'name' =>
'buildings',
- 'text' => lang('Building').':',
- 'list' => $this->bo->so->get_buildings(),
-
'onChangeSelect'=> 'requestWithBuildingFilter',
- ),
- array('type' =>
'filter',
- 'name' =>
'activities',
- 'text' => lang('Activity').':',
- 'list' =>
$this->bo->so->get_activities_main_level(),
- ),
- array('type' => 'text',
- 'text' => lang('searchfield'),
- 'name' =>
'query'
- ),
- array(
- 'type' =>
'submit',
- 'name' =>
'search',
- 'value' =>
lang('Search')
- ),
- array(
- 'type' =>
'link',
- 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
- 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
- ),
- ),
- ),
- ),
- 'datatable' => array
- (
- 'source' =>
self::link(array('menuaction' => 'controller.uiexample.index',
'phpgw_return_as' => 'json')),
- 'field' => array(
- array(
- 'key' => 'id',
- 'label' => lang('ID'),
- 'sortable' => true,
- 'formatter' =>
'YAHOO.portico.formatLink'
- ),
- array(
- 'key' => 'status',
- 'label' =>
lang('Status'),
- 'sortable' => false
- ),
- array(
- 'key' =>
'building_name',
- 'label' =>
lang('Building'),
- 'sortable' => true
- ),
- array(
- 'key' => 'what',
- 'label' => lang('What'),
- 'sortable' => false
- ),
- array(
- 'key' => 'created',
- 'label' =>
lang('Created'),
- 'sortable' => true
- ),
- array(
- 'key' => 'modified',
- 'label' => lang('last
modified'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'activity_name',
- 'label' =>
lang('Activity'),
- 'sortable' => true
- ),
- array(
- 'key' => 'contact_name',
- 'label' =>
lang('Contact'),
- 'sortable' => true
- ),
- array(
- 'key' => 'link',
- 'hidden' => true
- )
- )
- ),
- );
-//_debug_array($data);
- $parameters = array
- (
- 'parameter' => array
- (
- array
- (
- 'name' => 'id',
- 'source' => 'id'
- ),
- )
- );
-
- $actions = array
- (
- array
- (
- 'my_name' => 'view',
- 'text' => lang('view'),
- // 'confirm_msg' => lang('do you really
want to view this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'controller.uiexample.edit',
- )),
- 'parameters' => $parameters
- ),
- array
- (
- 'my_name' => 'edit',
- 'text' => lang('edit'),
- 'confirm_msg' => lang('do you really
want to edit this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'controller.uiexample.edit',
- )),
- 'parameters' => $parameters
- ),
- array
- (
- 'my_name' => 'delete',
- 'text' =>
lang('delete'),
- 'confirm_msg' => lang('do you really
want to delete this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'controller.uiexample.delete',
- )),
- 'parameters' => $parameters
- )
- );
-
- $data['actions'] = json_encode($actions);
-
-//_debug_array($data);die();
- self::render_template_xsl('datatable', $data);
- }
-
- public function index_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.uiexample.edit");
-//_debug_array($this->yui_results($applications));
- return $this->yui_results($applications);
- }
-
-
- public function edit()
- {
- self::set_active_menu('controller::example::edit');
- $repeat_type = $this->bo->get_rpt_type_list();
- $repeat_day = $this->bo->get_rpt_day_list();
-
- if(isset($_POST['save_control'])) // The user has
pressed the save button
- {
- if(isset($control)) // Edit control
- {
-
$control->set_title(phpgw::get_var('title'));
-
$control->set_description(phpgw::get_var('description'));
- $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
- $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
- $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
- $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
- $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
- $control->set_enabled( true );
-
- $this->so->add($control);
- }
- else // Add new control
- {
-
- $control = new controller_control();
-
-
$control->set_title(phpgw::get_var('title'));
-
$control->set_description(phpgw::get_var('description'));
- $control->set_start_date( strtotime(
phpgw::get_var('start_date') ) );
- $control->set_end_date( strtotime(
phpgw::get_var('end_date') ) );
- $control->set_repeat_day( strtotime(
phpgw::get_var('repeat_day') ) );
- $control->set_repeat_type( strtotime(
phpgw::get_var('repeat_type') ) );
- $control->set_repeat_interval(
strtotime( phpgw::get_var('repeat_interval') ) );
- $control->set_enabled( true );
-
- $this->so->add($control);
- }
- }
-
- $control_item_array =
$this->so_control_item->get_control_item_array();
- $control_group_array =
$this->so_control_group->get_control_group_array();
-
-
- if($this->flash_msgs)
- {
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
- }
-
- foreach ($control_area_array as $control_area)
- {
- $control_area_options = array
- (
- 'id' => $control_area->get_id(),
- 'name' => $control_area->get_title()
-
- );
- }
-
- foreach ($control_group_array as $control_group)
- {
- $control_group_options = array
- (
- 'id' => $control_group->get_id(),
- 'name' =>
$control_group->get_group_name()
-
- );
- }
-
- $data = array
- (
- 'value_id' =>
!empty($control) ? $control->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'editable' => true,
- 'control_item' =>
array('options' => $control_area_options),
- 'control_group' =>
array('options' => $control_group_options),
- );
-
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_item');
-
-
-
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
-
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
- $GLOBALS['phpgw']->richtext->generate_script();
-
-
- self::add_javascript('controller', 'yahoo',
'example_edit.js');
- self::render_template_xsl('example_edit', $data);
- }
-
-
- public function normal_tabs()
- {
-
self::set_active_menu('controller::example::normal_tabs');
-
- $resource_id = 80;
-
- $add_document_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiexample.index') );
- $resource = array('id' => $resource_id,
'add_document_link' => $add_document_link, 'permission' => array('write' =>
true ) );
-
- $tabs = array
- (
- 'general' => array('label' =>
lang('general'), 'link' => '#general'),
- 'list' => array('label' =>
lang('list'), 'link' => '#list'),
- 'dates' => array('label' =>
lang('dates'), 'link' => '#dates'),
- );
-
- phpgwapi_yui::tabview_setup('example_tabview');
-
-
- $data = array
- (
- 'tabs' =>
phpgwapi_yui::tabview_generate($tabs, 'general'),
- 'resource' => $resource,
- 'date' =>
$GLOBALS['phpgw']->yuical->add_listener('date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
time()))
- );
- self::add_javascript('controller', 'yahoo',
'example_normal_tabs.js');
- self::render_template_xsl('example_normal_tabs', $data);
- }
-
-
-
- public function separate_tabs()
- {
-
self::set_active_menu('controller::example::separate_tabs');
-
- $type = phpgw::get_var('type', 'string', 'REQUEST', null);
-
- $tabs = array();
- $tabs[] = array(
- 'label' => lang('Your preferences'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.separate_tabs', 'type' => 'user'))
- );
- $tabs[] = array(
- 'label' => lang('Default preferences'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.separate_tabs', 'type' => 'default'))
- );
- $tabs[] = array(
- 'label' => lang('Forced preferences'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uiexample.separate_tabs', 'type' => 'forced'))
- );
-
- switch($type)
- {
- case 'default':
- $selected = 1;
- $resource_id = 81;
- break;
- case 'forced':
- $selected = 2;
- $resource_id = 46;
- break;
- case 'user':
- default:
- $selected = 0;
- $resource_id = 80;
- }
-
- $add_document_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uiexample.index') );
- $resource = array('id' => $resource_id,
'add_document_link' => $add_document_link, 'permission' => array('write' =>
true ) );
-
- $data = array
- (
- 'tabs' =>
$GLOBALS['phpgw']->common->create_tabs($tabs, $selected),
- 'resource' => $resource
- );
- self::add_javascript('controller', 'yahoo',
'example_separate_tabs.js');
- self::render_template_xsl('example_separate_tabs',
$data);
- }
-
-
- public function delete()
- {
- return 'deleted';
- }
-
- public function js_poll()
- {
- if($poll = phpgw::get_var('poll'))
- {
- return $poll;
- }
- return 'hello world';
- }
-
- public function query()
- {
- var_dump("Er i uicontrol");
-
- }
- }
Added: trunk/controller/inc/class.uilocation_check_list.inc.php
===================================================================
--- trunk/controller/inc/class.uilocation_check_list.inc.php
(rev 0)
+++ trunk/controller/inc/class.uilocation_check_list.inc.php 2011-11-14
06:32:22 UTC (rev 8093)
@@ -0,0 +1,320 @@
+<?php
+ 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/');
+
+ 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;
+
+ 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
+ );
+
+ 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');
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::check_list";
+ }
+
+ public function view_check_lists_for_location()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $control = $this->so_control->get_single($control_id);
+
+ $view = "VIEW_YEAR";
+
+ $location_code = "1101";
+
+ // Gets an array of controls that contains check_lists
for the specified location
+ $control_array =
$this->so->get_check_lists_for_location( $location_code );
+
+ $controls_calendar_array = $this->build_calendar_array(
$control_array );
+
+ $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
+ );
+
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
+
self::render_template_xsl('view_check_lists_for_location', $data);
+ }
+
+ // Function receives array with control objects that each
contain check_lists for a certain period
+ public function build_calendar_array( $control_array ){
+
+ $calendar_array = array();
+
+ foreach($control_array as $control){
+
+ $start_date = $control->get_start_date();
+ $end_date = $control->get_end_date();
+
+ // Initialises twelve_months_array
+ for($i=0;$i<12;$i++){
+ $calendar_array[$i] = null;
+ }
+
+ // Inserts check_list object on deadline month
in twelve_months_array
+ foreach($control->get_check_lists_array() as
$check_list){
+
+ $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() == 'Ikke
utført'){
+
$check_list_status_info->set_status(0);
+ }
+
+ $check_list_status_info->set_deadline(
date("d/m-Y", $check_list->get_deadline()) );
+
+
+ $calendar_array[ date("m",
$check_list->get_deadline()) - 1 ] = $check_list_status_info->serialize();
+ }
+
+ $control_calendar_array[] = array("control" =>
$control->toArray(), "calendar_array" => $calendar_array);
+ }
+
+ return $control_calendar_array;
+ }
+
+ 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);
+ }
+ }
Modified: trunk/controller/inc/class.uiprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.uiprocedure.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/class.uiprocedure.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -12,11 +12,12 @@
public $public_functions = array
(
- 'index' => true,
- 'query' => true,
- 'edit' => true,
- 'view' => true,
- 'add' => true
+ 'index' => true,
+ 'query' => true,
+ 'edit' => true,
+ 'view' => true,
+ 'add' => true,
+ 'get_procedures' => true
);
public function __construct()
@@ -282,6 +283,17 @@
}
}
+ // Returns check list info as JSON
+ public function get_procedures()
+ {
+ $control_area_id = phpgw::get_var('control_area_id');
+
+ $procedures_array =
$this->so->get_procedures_by_control_area_id($control_area_id);
+
+ return json_encode( $procedures_array );
+ }
+
+
/**
* Public method. Forwards the user to edit mode.
*/
Deleted: trunk/controller/inc/helper/class.calender_cell.inc.php
===================================================================
--- trunk/controller/inc/helper/class.calender_cell.inc.php 2011-11-13
21:03:29 UTC (rev 8092)
+++ trunk/controller/inc/helper/class.calender_cell.inc.php 2011-11-14
06:32:22 UTC (rev 8093)
@@ -1,46 +0,0 @@
-<?php
- class calendar_cell
- {
- private $id;
- private $status;
- private $deadline;
-
- public function __construct(int $id, $status, $deadline)
- {
- $this->id = (int)$id;
- $this->status = $status;
- $this->deadline = $deadline;
- }
-
- public function set_id($id)
- {
- $this->id = $id;
- }
-
- public function get_id() { return $this->id; }
-
- public function set_status($status)
- {
- $this->status = $status;
- }
-
- public function get_status() { return $this->status; }
-
- public function set_deadline($deadline)
- {
- $this->deadline = $deadline;
- }
-
- public function get_deadline() { return $this->deadline; }
-
-
- public function serialize()
- {
- return array(
- 'id' => $this->get_id(),
- 'status' => $this->get_status(),
- 'deadline' => $this->get_deadline()
- );
- }
- }
-?>
\ No newline at end of file
Copied: trunk/controller/inc/helper/class.check_list_status_info.inc.php (from
rev 8091, trunk/controller/inc/helper/class.calender_cell.inc.php)
===================================================================
--- trunk/controller/inc/helper/class.check_list_status_info.inc.php
(rev 0)
+++ trunk/controller/inc/helper/class.check_list_status_info.inc.php
2011-11-14 06:32:22 UTC (rev 8093)
@@ -0,0 +1,50 @@
+<?php
+ class check_list_status_info
+ {
+ private $id;
+ private $status;
+ private $status_text;
+ private $deadline;
+
+ public function __construct(){}
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ public function get_id() { return $this->id; }
+
+ public function set_status($status)
+ {
+ $this->status = $status;
+ }
+
+ public function get_status() { return $this->status; }
+
+ public function set_status_text($status_text)
+ {
+ $this->status_text = $status_text;
+ }
+
+ public function get_status_text() { return $this->status_text; }
+
+ public function set_deadline($deadline)
+ {
+ $this->deadline = $deadline;
+ }
+
+ public function get_deadline() { return $this->deadline; }
+
+
+ public function serialize()
+ {
+ return array(
+ 'id' => $this->get_id(),
+ 'status' => $this->get_status(),
+ 'status_text' => $this->get_status_text(),
+ 'deadline' => $this->get_deadline()
+ );
+ }
+ }
+?>
\ No newline at end of file
Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/model/class.check_list.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -12,7 +12,10 @@
protected $deadline;
protected $planned_date;
protected $completed_date;
+ protected $location_code;
+ protected $equipment_id;
protected $check_item_array = array();
+ protected $control;
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -81,6 +84,27 @@
public function get_completed_date() { return
$this->completed_date; }
+ public function set_location_code($location_code)
+ {
+ $this->location_code = $location_code;
+ }
+
+ public function get_location_code() { return
$this->location_code; }
+
+ public function set_equipment_id($equipment_id)
+ {
+ $this->equipment_id = $equipment_id;
+ }
+
+ public function get_equipment_id() { return
$this->equipment_id; }
+
+ public function set_control($control)
+ {
+ $this->control = $control;
+ }
+
+ public function get_control() { return $this->control; }
+
public function serialize()
{
return array(
Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/inc/model/class.control.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -24,6 +24,9 @@
protected $control_area_id;
protected $control_area_name;
+ protected $check_lists_array = array();
+
+
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
* the database the ID should be empty so the database can add
one according to its logic.
@@ -70,13 +73,6 @@
public function get_start_date() { return $this->start_date; }
- public function set_repeat_day($repeat_day)
- {
- $this->repeat_day = $repeat_day;
- }
-
- public function get_repeat_day() { return $this->repeat_day; }
-
public function set_repeat_type($repeat_type)
{
$this->repeat_type = $repeat_type;
@@ -168,6 +164,13 @@
public function get_control_area_name() { return
$this->control_area_name; }
+ public function set_check_lists_array($check_lists_array)
+ {
+ $this->check_lists_array = $check_lists_array;
+ }
+
+ public function get_check_lists_array() { return
$this->check_lists_array; }
+
/**
* Get a static reference to the storage object associated with
this model object
*
@@ -190,6 +193,8 @@
$this->set_end_date(strtotime(
phpgw::get_var('end_date_hidden','string') ));
$this->set_procedure_id(phpgw::get_var('procedure_id','int'));
$this->set_control_area_id(phpgw::get_var('control_area_id','int'));
+
$this->set_repeat_type(phpgw::get_var('repeat_type','int'));
+
$this->set_repeat_interval(phpgw::get_var('repeat_interval','int'));
}
public function serialize()
@@ -203,7 +208,10 @@
'procedure_id' => $this->get_procedure_id(),
'procedure_name' => $this->get_procedure_name(),
'control_area_id' =>
$this->get_control_area_id(),
- 'control_area_name' =>
$this->get_control_area_name()
+ 'control_area_name' =>
$this->get_control_area_name(),
+ 'repeat_type' => $this->get_repeat_type(),
+ 'repeat_interval' =>
$this->get_repeat_interval(),
+
);
}
}
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2011-11-13 21:03:29 UTC (rev
8092)
+++ trunk/controller/js/controller/ajax.js 2011-11-14 06:32:22 UTC (rev
8093)
@@ -1,5 +1,30 @@
$(document).ready(function(){
+
+
+ // When control area is chosen in control.xsl select procedure is
populated
+ $("#control_area_id option").click(function () {
+ var control_area_id = $(this).val();
+ var requestUrl =
"index.php?menuaction=controller.uiprocedure.get_procedures&phpgw_return_as=json"
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl + "&control_area_id=" +
control_area_id,
+ success: function(data) {
+ var obj = jQuery.parseJSON(data);
+ var htmlString = "";
+
+ $.each(obj, function(i) {
+ htmlString += "<option value='" +
obj[i].id + "'>" + obj[i].title + "</option>";
+ });
+
+ $("#procedure_id").html( htmlString );
+ }
+ });
+
+ });
+
// Saves order of control items for a group
$(".frm_save_order").submit(function(e){
e.preventDefault();
@@ -33,4 +58,59 @@
}
});
});
-});
\ No newline at end of file
+
+ // Fetches info about a check list when one hovers over an a tag
+ $("a.view_list").hover(function(){
+ var thisA = $(this);
+ var divWrp = $(this).parent();
+ var requestUrl = $(thisA).attr("href");
+
+ $.ajax({
+ type: 'POST',
+ url: requestUrl,
+ dataType: 'json',
+ success: function(data) {
+ var obj = jQuery.parseJSON(data);
+
+ // Show info box with info about check list
+ var infoBox = $(divWrp).find("#info_box");
+ $(infoBox).show();
+ $(infoBox).html("");
+
+ if(obj.deadline == 0 ){
+ var deadline_string = "Ikke satt";
+ }else{
+ var date = new Date(obj.deadline * 1000);
+ var deadline_string = date.getDate() + "/" +
(parseInt(date.getMonth()) + 1) + "-" + date.getFullYear();
+ }
+
+ var months = ['Januar', 'Februar', 'Mars', 'April',
'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November',
'Desember'];
+
+
+ $(infoBox).html("<h5>Sjekkliste for " +
months[date.getMonth()]);
+
+ var htmlList = "<ul>" +
+
"<li><label>Frist</label><span> " + deadline_string + "</span></li>" +
+
"<li><label>Status</label><span> " + obj.status + "</span></li>" +
+
"<li><label>Kommentar</label><span>" + obj.comment + "</span></li>" +
+
"<li><label>Sjekkpunkter</label><li>";
+
+ $.each(obj.check_item_array, function(i) {
+ htmlList += "<ul><li><label>" +
(parseInt(i) + 1) + ": Tittel</label><span>" +
obj.check_item_array[i].control_item.title + "</span></li>" +
+
"<li><label>Status</label><span>" + obj.check_item_array[i].status +
"</span></li>" +
+
"<li><label>Kommentar</label><span>" + obj.check_item_array[i].comment +
"</span></li></ul>";
+ });
+
+ htmlList += "</li></ul>";
+
+ $(infoBox).append( htmlList );
+ }
+ });
+ },
+ function(){
+ // Hide info box when mouse not over status icon
+ var infoBox = $(this).parent().find("#info_box");
+ $(infoBox).hide();
+
+ });
+});
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2011-11-13 21:03:29 UTC (rev
8092)
+++ trunk/controller/setup/phpgw_no.lang 2011-11-14 06:32:22 UTC (rev
8093)
@@ -2,6 +2,7 @@
controller common no Kontroll
control_helptext controller no Her kommer hjelpetekst for å
opprette en kontroll
Check_list controller no Sjekkliste
+Check_list_location controller no Sjekkliste for bygg
Check_lists controller no Sjekklister
Choose_control_groups controller no Velg kontrollgrupper
Choose_control_items controller no Velg kontrollpunkt
Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
+++ trunk/controller/setup/setup.inc.php 2011-11-14 06:32:22 UTC (rev
8093)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.7';
+ $setup_info['controller']['version'] = '0.1.8';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/setup/tables_update.inc.php 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -129,4 +129,22 @@
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.7';
return $GLOBALS['setup_info']['controller']['currentver'];
}
+
+ /* Update Controller from v 0.1.7 to 0.1.8 */
+
+ $test[] = '0.1.7';
+ function controller_upgrade0_1_7()
+ {
+
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(),
'status');
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item','status',array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => true,
+ 'default' => 0
+ ));
+
+ $GLOBALS['setup_info']['controller']['currentver'] = '0.1.8';
+ return $GLOBALS['setup_info']['controller']['currentver'];
+ }
?>
\ No newline at end of file
Modified: trunk/controller/templates/base/control_groups.xsl
===================================================================
--- trunk/controller/templates/base/control_groups.xsl 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/templates/base/control_groups.xsl 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -4,23 +4,28 @@
<div id="control_groups">
<h2><xsl:value-of select="control_area/title"/></h2>
+
+ <form
action="index.php?menuaction=controller.uicontrol.view_control_items"
method="post">
+ <xsl:variable name="control_area_id"><xsl:value-of
select="control_area/id"/></xsl:variable>
+ <input type="hidden" name="control_area_id"
value="{$control_area_id}" />
- <form
action="index.php?menuaction=controller.uicontrol.view_control_items"
method="post">
- <xsl:variable name="control_area_id"><xsl:value-of
select="control_area/id"/></xsl:variable>
- <input type="hidden" name="control_area_id"
value="{$control_area_id}" />
-
- <xsl:variable name="control_id"><xsl:value-of
select="control_id"/></xsl:variable>
- <input type="hidden" name="control_id" value="{control_id}" />
-
- <ul class="itemlist">
- <xsl:for-each select="//control_groups">
- <xsl:variable name="control_group_id"><xsl:value-of
select="id"/></xsl:variable>
- <li><input type="checkbox" name="control_group_ids[]"
value="{$control_group_id}" /><xsl:value-of select="group_name"/></li>
- </xsl:for-each>
- </ul>
- <div>
- <xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
- <input type="submit" name="save_control_groups"
value="{$lang_save}" title = "{$lang_save}" />
+ <xsl:variable name="control_id"><xsl:value-of
select="control_id"/></xsl:variable>
+ <input type="hidden" name="control_id"
value="{control_id}" />
+
+ <ul class="itemlist">
+ <xsl:for-each select="//control_groups">
+ <xsl:variable
name="control_group_id"><xsl:value-of select="id"/></xsl:variable>
+
+ <xsl:for-each
select="chosen_control_groups">
+ <xsl:value-of select="."/>
+ </xsl:for-each>
+
+ <li><input type="checkbox"
name="control_group_ids[]" value="{$control_group_id}" /><xsl:value-of
select="group_name"/></li>
+ </xsl:for-each>
+ </ul>
+ <div>
+ <xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
+ <input type="submit" name="save_control_groups"
value="{$lang_save}" title = "{$lang_save}" />
</div>
</form>
</div>
Deleted: trunk/controller/templates/base/control_items.xsl
===================================================================
--- trunk/controller/templates/base/control_items.xsl 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/templates/base/control_items.xsl 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -1,43 +0,0 @@
-<xsl:template name="control_items" xmlns:php="http://php.net/xsl">
-
-<div class="yui-content tab_content">
- <div>
-
- <!-- =========================== CHOOSE CONTROL ITEMS
=============================== -->
- <h2>Velg dine kontrollpunkt</h2>
-
- <h4 class="expand_header"><div class="expand_all">Vis
alle</div><div class="collapse_all">Skjul alle</div></h4>
- <form id="frm_control_items"
action="index.php?menuaction=controller.uicontrol.save_control_items"
method="post">
- <xsl:variable name="control_id"><xsl:value-of
select="control_id"/></xsl:variable>
- <input type="hidden" name="control_id"
value="{control_id}" />
-
- <xsl:variable name="control_group_ids"><xsl:value-of
select="control_group_ids"/></xsl:variable>
- <input type="hidden" name="control_group_ids"
value="{control_group_ids}" />
-
- <ul class="control_items">
- <xsl:for-each
select="groups_with_control_items">
- <ul class="itemlist expand_list">
- <li>
- <h4><img
src="controller/images/arrow_left.png" width="14"/><span><xsl:value-of
select="control_group/group_name"/></span></h4>
- <xsl:variable
name="control_group_id"><xsl:value-of select="control_group/id"/></xsl:variable>
- <ul>
- <xsl:for-each
select="group_control_items">
- <xsl:variable
name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
-
- <li><xsl:number/>.
<input type="checkbox" id="ch_{$control_group_id}:{$control_item_id}"
value="{$control_group_id}:{$control_item_id}" /><xsl:value-of
select="title"/></li>
- </xsl:for-each>
- </ul>
- </li>
- </ul>
- </xsl:for-each>
- </ul>
-
- <div>
- <xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
- <input type="submit" name="save_control_items"
value="{$lang_save}" title = "{$lang_save}" />
- </div>
- </form>
-
- </div>
-</div>
-</xsl:template>
\ No newline at end of file
Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css 2011-11-13 21:03:29 UTC
(rev 8092)
+++ trunk/controller/templates/base/css/base.css 2011-11-14 06:32:22 UTC
(rev 8093)
@@ -818,8 +818,64 @@
}
#frm_save_check_items h1 {
float: left;
- margin: 5px 0;
+ margin: 5px;
}
ul.check_list {
width: 925px;
+}
+ul.calendar li{
+ clear:left;
+}
+ul.calendar li.heading div {
+ font-weight: bold;
+}
+ul.calendar li div {
+ float: left;
+ text-align: center;
+ width: 50px;
+ padding: 3px;
+}
+
+ul.calendar li div.date {
+ width: 80px;
+}
+
+ul.calendar div.title{
+ width: 200px;
+}
+
+#info_box {
+ background: none repeat scroll 0 0 #EDF5FF;
+ border: 1px solid #243356;
+ left: 40px;
+ padding: 10px;
+ position: absolute;
+ text-align: left;
+ top: 3px;
+ width: 350px;
+ z-index: 1;
+ font-size:12px;
+}
+
+#info_box label{
+ font-weight:bold;
+ margin-right:2px;
+ font-size:12px;
+ display: inline-block;
+ width: 70px;
+}
+
+#info_box ul li ul label{
+ display: inline;
+}
+
+#info_box ul li ul {
+ margin: 5px 0;
+ padding-left: 5px;
+}
+#info_box h5 {
+ font-size: 15px;
+ font-weight: bold;
+ padding: 0 0 8px;
+ text-align: center;
}
\ No newline at end of file
Modified: trunk/controller/templates/base/view_check_lists.xsl
===================================================================
--- trunk/controller/templates/base/view_check_lists.xsl 2011-11-13
21:03:29 UTC (rev 8092)
+++ trunk/controller/templates/base/view_check_lists.xsl 2011-11-14
06:32:22 UTC (rev 8093)
@@ -18,8 +18,8 @@
<xsl:if test="control_as_array/end_date != ''">
<xsl:value-of select="php:function('date',
$date_format, number(control_as_array/end_date))"/><br/>
</xsl:if>
- <label>Syklustype</label><xsl:value-of
select="control_as_array/repeat_type"/><br/>
- <label>Syklusfrekvens</label><xsl:value-of
select="control_as_array/repeat_interval"/><br/>
+ <label>Frekvenstype</label><xsl:value-of
select="control_as_array/repeat_type"/><br/>
+ <label>Frekvens</label><xsl:value-of
select="control_as_array/repeat_interval"/><br/>
</fieldset>
<h2>Sjekklister</h2>
@@ -78,5 +78,15 @@
</xsl:otherwise>
</xsl:choose>
</ul>
+ <a>
+ <xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicheck_list.control_calendar_status_overview</xsl:text>
+ <xsl:text>&control_id=</xsl:text>
+ <xsl:value-of
select="control_as_array/id"/>
+ </xsl:attribute>
+ <div style="margin-top:30px">
+ Se kalenderoversikt for kontroll
+ </div>
+ </a>
</div>
</xsl:template>
\ No newline at end of file
Added: trunk/controller/templates/base/view_check_lists_for_location.xsl
===================================================================
--- trunk/controller/templates/base/view_check_lists_for_location.xsl
(rev 0)
+++ trunk/controller/templates/base/view_check_lists_for_location.xsl
2011-11-14 06:32:22 UTC (rev 8093)
@@ -0,0 +1,81 @@
+<xsl:template match="data" name="view_check_lists"
xmlns:php="http://php.net/xsl">
+<xsl:variable name="date_format">d/m-Y</xsl:variable>
+
+<div id="main_content">
+
+ <h1>Kalenderoversikt</h1>
+ <fieldset class="check_list_details">
+ Oversikt for <xsl:value-of
select="location_array/loc1_name"/>
+ </fieldset>
+
+ <h2>Sjekklister</h2>
+
+ <ul class="calendar">
+ <li class="heading">
+ <div>Id</div><div
class="title">Tittel</div><div class="date">Startdato</div><div
class="date">Sluttdato</div>
+
<div>Jan</div><div>Feb</div><div>Mar</div><div>Apr</div><div>Mai</div><div>Jun</div>
+
<div>Jul</div><div>Aug</div><div>Sep</div><div>Okt</div><div>Nov</div><div>Des</div>
+ </li>
+ <xsl:choose>
+ <xsl:when
test="controls_calendar_array/child::node()">
+ <xsl:for-each
select="controls_calendar_array">
+ <li>
+ <div>
+ <xsl:value-of
select="control/id"/>
+ </div>
+ <div class="title">
+ <xsl:value-of
select="control/title"/>
+ </div>
+ <div class="date">
+ <xsl:value-of
select="php:function('date', 'd/m-Y', number(control/start_date))"/>
+ </div>
+ <div class="date">
+ <xsl:choose>
+
<xsl:when test="control/end_date != 0">
+
<xsl:value-of select="php:function('date', 'd/m-Y', number(control/end_date))"/>
+
</xsl:when>
+
<xsl:otherwise>
+
Løpende
+
</xsl:otherwise>
+ </xsl:choose>
+ </div>
+ <xsl:for-each
select="calendar_array">
+ <div
style="position:relative;">
+ <div id="info_box"
style="position:absolute;display:none;">
+ </div>
+ <xsl:choose>
+
<xsl:when test="id">
+
<xsl:variable name="status"><xsl:value-of
select="status"/></xsl:variable>
+
<xsl:choose>
+
<xsl:when test="status = 1">
+
<img height="15"
src="controller/images/status_icon_light_green.png" />
+
</xsl:when>
+
<xsl:otherwise>
+
<a class="view_list">
+
<xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicheck_list.get_check_list_info</xsl:text>
+
<xsl:text>&phpgw_return_as=json</xsl:text>
+
<xsl:text>&check_list_id=</xsl:text>
+
<xsl:value-of select="id"/>
+
</xsl:attribute>
+
<img height="15"
src="controller/images/status_icon_red.png" />
+
</a>
+
</xsl:otherwise>
+
</xsl:choose>
+
</xsl:when>
+
<xsl:otherwise>
+
<img height="15" src="controller/images/status_icon_yellow.png" />
+
</xsl:otherwise>
+
</xsl:choose>
+ </div>
+ </xsl:for-each>
+ </li>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ Ingen sjekklister for denne kontrollen
+ </xsl:otherwise>
+ </xsl:choose>
+ </ul>
+</div>
+</xsl:template>
\ No newline at end of file
Property changes on:
trunk/controller/templates/base/view_check_lists_for_location.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8093] Added menu choice that displays controls for a location.,
Torstein <=