[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7947]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [7947] |
Date: |
Wed, 26 Oct 2011 09:10:27 +0000 |
Revision: 7947
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7947
Author: vator
Date: 2011-10-26 09:10:27 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
Added Paths:
-----------
trunk/controller/inc/class.socontrol_group_list.inc.php
Added: trunk/controller/inc/class.socontrol_group_list.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group_list.inc.php
(rev 0)
+++ trunk/controller/inc/class.socontrol_group_list.inc.php 2011-10-26
09:10:27 UTC (rev 7947)
@@ -0,0 +1,148 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'control_group_list', 'inc/model/');
+
+class controller_socontrol_group_list extends controller_socommon
+{
+ protected static $so;
+
+ /**
+ * Get a static reference to the storage object associated with this
model object
+ *
+ * @return controller_socontrol_group the storage object
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null) {
+ self::$so =
CreateObject('controller.socontrol_group_list');
+ }
+ return self::$so;
+ }
+
+ /**
+ * Function for adding a new control group to the database.
+ *
+ * @param controller_control_group $control_group the control group to
be added
+ * @return int id of the new control group object
+ */
+ function add(&$control_group_list)
+ {
+ $cols = array(
+ 'control_id',
+ 'control_group_id',
+ 'order_nr'
+ );
+
+ $values = array(
+ $this->marshal($control_group_list->get_control_id(),
'int'),
+
$this->marshal($control_group_list->get_control_group_id(), 'int'),
+ $this->marshal($control_group_list->get_order_nr(),
'int')
+ );
+
+ $result = $this->db->query('INSERT INTO
controller_control_group_list (' . join(',', $cols) . ') VALUES (' . join(',',
$values) . ')', __LINE__,__FILE__);
+
+ if(isset($result)) {
+ // Get the new control group ID and return it
+ return
$this->db->get_last_insert_id('controller_control_group_list', 'id');
+ }
+ else
+ {
+ return 0;
+ }
+
+ }
+
+ /**
+ * Update the database values for an existing activity object.
+ *
+ * @param $activity the activity to be updated
+ * @return boolean true if successful, false otherwise
+ */
+
+ function update($control_group_list)
+ {
+ $id = intval($control_group_list->get_id());
+
+ $values = array(
+ 'control_id = ' .
$this->marshal($control_group_list->get_control_id(), 'string'),
+ 'control_group_id = '.
$this->marshal($control_group_list->get_control_group_id(), 'int'),
+ 'order_nr = ' .
$this->marshal($control_group_list->get_order_nr(), 'int')
+ );
+
+ //var_dump('UPDATE activity_activity SET ' . join(',', $values)
. " WHERE id=$id");
+ $result = $this->db->query('UPDATE
controller_control_group_list SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
+
+ return isset($result);
+ }
+
+ /**
+ * Get single procedure
+ *
+ * @param $id id of the procedure to return
+ * @return a controller_procedure
+ */
+ function get_single($id)
+ {
+ $id = (int)$id;
+
+ $sql = "SELECT p.* FROM controller_control_group_list p WHERE
p.id = " . $id;
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+
+ if($this->db->next_record()){
+ $control_group_list = new
controller_control_group_list($this->unmarshal($this->db->f('id', true),
'int'));
+
$control_group_list->set_control_id($this->unmarshal($this->db->f('control_id',
true), 'int'));
+
$control_group_list->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
'int'));
+
$control_group_list->set_order_nr($this->unmarshal($this->db->f('order_nr'),
'int'));
+
+ return $control_group_list;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ function get_single_2($control_id, $control_group_id)
+ {
+ $sql = "SELECT p.* FROM controller_control_group_list p WHERE
p.control_id=" . $control_id . " AND p.control_group_id=" . $control_group_id;
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+
+ if($this->db->next_record()){
+ $control_group_list = new
controller_control_group_list($this->unmarshal($this->db->f('id', true),
'int'));
+
$control_group_list->set_control_id($this->unmarshal($this->db->f('control_id',
true), 'int'));
+
$control_group_list->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
'int'));
+
$control_group_list->set_order_nr($this->unmarshal($this->db->f('order_nr'),
'int'));
+
+ return $control_group_list;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean
$return_count){}
+
+ function get_id_field_name($extended_info = false){}
+
+ function populate(int $control_group_id, &$control_group)
+ {
+ /*
+ if($control_group == null) {
+ $control_group = new controller_control_group((int)
$control_group_id);
+
+
$control_group->set_group_name($this->unmarshal($this->db->f('group_name'),
'string'));
+
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
+
$control_group->set_procedure_name($this->unmarshal($this->db->f('procedure_title'),
'string'));
+
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
+
$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
+
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
'int'));
+
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
'string'));
+ }
+ //var_dump($control_group);
+ return $control_group;
+ */
+ }
+
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7947],
Torstein <=