[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] hrm/inc class.uiuser.inc.php, 1.2 class.uijob.inc.php
From: |
sigurdne |
Subject: |
[Phpgroupware-cvs] hrm/inc class.uiuser.inc.php, 1.2 class.uijob.inc.php, 1.2 class.bouser.inc.php, 1.2 class.sojob.inc.php, 1.2 class.bojob.inc.php, 1.2 |
Date: |
Mon, 21 Nov 2005 16:49:00 +0100 |
Update of hrm/inc
Modified Files:
Branch: MAIN
class.uiuser.inc.php lines: +1 -2
class.uijob.inc.php lines: +143 -42
class.bouser.inc.php lines: +2 -3
class.sojob.inc.php lines: +66 -86
class.bojob.inc.php lines: +44 -9
Log Message:
*** empty log message ***
====================================================
Index: hrm/inc/class.uiuser.inc.php
diff -u hrm/inc/class.uiuser.inc.php:1.1 hrm/inc/class.uiuser.inc.php:1.2
--- hrm/inc/class.uiuser.inc.php:1.1 Mon Nov 21 12:01:20 2005
+++ hrm/inc/class.uiuser.inc.php Mon Nov 21 15:49:09 2005
@@ -61,7 +61,6 @@
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
- 'allrows' => $this->allrows
);
$this->bo->save_sessiondata($data);
}
====================================================
Index: hrm/inc/class.uijob.inc.php
diff -u hrm/inc/class.uijob.inc.php:1.1 hrm/inc/class.uijob.inc.php:1.2
--- hrm/inc/class.uijob.inc.php:1.1 Mon Nov 21 12:01:20 2005
+++ hrm/inc/class.uijob.inc.php Mon Nov 21 15:49:09 2005
@@ -28,10 +28,11 @@
var $public_functions = array
(
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
+ 'index' => True,
+ 'view' => True,
+ 'edit_job' => True,
+ 'edit' => True,
+ 'delete' => True
);
function uijob()
@@ -59,8 +60,7 @@
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
- 'order' => $this->order,
- 'allrows' => $this->allrows
+ 'order' => $this->order
);
$this->bo->save_sessiondata($data);
}
@@ -75,21 +75,32 @@
$receipt =
$GLOBALS['phpgw']->session->appsession('session_data','hrm_job_receipt');
$GLOBALS['phpgw']->session->appsession('session_data','hrm_job_receipt','');
- //$account_info = $this->bo->read();
+ $job_info = $this->bo->read();
- while (is_array($account_info) && list(,$entry) =
each($account_info))
+ while (is_array($job_info) && list(,$entry) =
each($job_info))
{
+ if ($entry['level'] > 0)
+ {
+ $space = '--';
+ $spaceset =
str_repeat($space,$entry['level']);
+ $entry['name'] = $spaceset .
$entry['name'];
+ }
+
+
$content[] = array
(
- 'first_name'
=> $entry['account_firstname'],
- 'last_name'
=> $entry['account_lastname'],
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.edit&id='
. $entry['account_id']),
- 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.view&id='
. $entry['account_id']),
- 'lang_view_job_text' => lang('view
the job'),
- 'lang_edit_job_text' => lang('edit
the job'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
+ 'name' =>
$entry['name'],
+ 'descr' =>
$entry['descr'],
+ 'link_add_sub' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.edit_job&parent_id='
. $entry['id']),
+ 'link_edit' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.edit_job&id='
. $entry['id']),
+ 'link_view' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.view_job&id='
. $entry['id']),
+ 'lang_view_job_text' =>
lang('view the job'),
+ 'lang_edit_job_text' =>
lang('edit the job'),
+ 'lang_add_sub_text' =>
lang('Add a new sub-job'),
+ 'text_view' =>
lang('view'),
+ 'text_edit' =>
lang('edit'),
+ 'text_add_sub' =>
lang('Add sub'),
);
}
@@ -97,33 +108,19 @@
$table_header[] = array
(
-
- 'sort_last_name' =>
$this->nextmatchs->show_sort_order(array
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
-
'var' => 'account_lastname',
+
'var' => 'name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uijob.index',
'query' =>$this->query,
-
'district_id' => $this->district_id,
-
'entity_id' =>$this->entity_id,
'cat_id' =>$this->cat_id,
'allrows' => $this->allrows)
)),
- 'lang_last_name' => lang('Last name'),
- 'sort_first_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'account_firstname',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uijob.index',
-
'query' =>$this->query,
-
'district_id' => $this->district_id,
-
'entity_id' =>$this->entity_id,
-
'cat_id' =>$this->cat_id,
-
'allrows' => $this->allrows)
-
)),
- 'lang_first_name' => lang('First name'),
+ 'lang_add_sub' => lang('Add sub'),
+ 'lang_name' => lang('name'),
+ 'lang_descr' => lang('descr'),
'lang_edit' => lang('edit'),
'lang_view' => lang('view'),
);
@@ -132,10 +129,7 @@
(
'lang_add' =>
lang('add'),
'lang_add_categorytext' => lang('add a
category'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.edit&type='.$type
. '&type_id=' . $type_id),
- 'lang_done' =>
lang('done'),
- 'lang_done_categorytext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.edit_job')
);
if(!$this->allrows)
@@ -167,7 +161,7 @@
'allrows'
=> $this->allrows,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
- 'num_records'
=> count($account_info),
+ 'num_records'
=> count($job_info),
'all_records'
=> $this->bo->total_records,
'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
@@ -177,7 +171,7 @@
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'values'
=> $content,
- 'table_add'
=> $table_add
+ 'table_add_job'
=> $table_add
);
$appname =
lang('job');
@@ -187,6 +181,113 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$this->save_sessiondata();
+ }
+
+ function edit_job()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $parent_id =
get_var('parent_id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('job'));
+
+ if (is_array($values))
+ {
+ if ($values['save'] || $values['apply'])
+ {
+ if(!$values['name'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+ }
+
+
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_job($values,$action);
+ $id = $receipt['id'];
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','hrm_job_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uijob.index');
+ }
+ }
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uijob.index');
+ }
+ }
+
+ if ($id)
+ {
+ $values = $this->bo->read_single_job($id);
+ $function_msg = lang('edit job');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add job');
+ $action='add';
+ }
+
+
+ if($parent_id)
+ {
+ $values['parent_id'] = $parent_id;
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uijob.edit_job',
+ 'id' => $id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.index&type='.$type
. '&type_id=' . $type_id),
+ 'lang_id' =>
lang('category ID'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'value_id' => $id,
+
+ 'parent_list' =>
$this->bo->select_job_list($values['parent_id']),
+ 'lang_parent' =>
lang('parent'),
+ 'lang_parent_status_text' =>
lang('Select this jobs parent'),
+ 'lang_no_parent' =>
lang('select a parent'),
+
+ 'lang_name' =>
lang('name'),
+ 'lang_name_status_text' =>
lang('name of the job-type'),
+
+
+ 'lang_id_categorytext' => lang('Enter the
category ID'),
+ 'lang_descr_categorytext'
=> lang('Enter a description the category'),
+ 'lang_done_categorytext'
=> lang('Back to the list'),
+ 'lang_save_categorytext'
=> lang('Save the category'),
+ 'type_id' =>
$values['type_id'],
+ 'value_descr'
=> $values['descr'],
+ 'value_name'
=> $values['name'],
+
+ 'lang_cancel' =>
lang('cancel'),
+ 'lang_save_status_text' =>
lang('Save the training'),
+ 'lang_apply' =>
lang('apply'),
+ 'lang_apply_status_text' =>
lang('Apply the values'),
+ );
+
+ $appname =
lang('job');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_job' => $data));
}
function edit()
====================================================
Index: hrm/inc/class.bouser.inc.php
diff -u hrm/inc/class.bouser.inc.php:1.1 hrm/inc/class.bouser.inc.php:1.2
--- hrm/inc/class.bouser.inc.php:1.1 Mon Nov 21 12:01:20 2005
+++ hrm/inc/class.bouser.inc.php Mon Nov 21 15:49:09 2005
@@ -102,7 +102,7 @@
{
$this->cat_id = $cat_id;
}
- if(array_key_exists('allrows',$_POST) ||
array_key_exists('allrows',$_GET))
+ if ($allrows)
{
$this->allrows = $allrows;
}
@@ -127,7 +127,6 @@
$this->sort = $data['sort'];
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
- $this->allrows = $data['allrows'];
}
====================================================
Index: hrm/inc/class.sojob.inc.php
diff -u hrm/inc/class.sojob.inc.php:1.1 hrm/inc/class.sojob.inc.php:1.2
--- hrm/inc/class.sojob.inc.php:1.1 Mon Nov 21 12:01:20 2005
+++ hrm/inc/class.sojob.inc.php Mon Nov 21 15:49:09 2005
@@ -24,10 +24,10 @@
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->join = $this->socommon->join;
- $this->like = $this->socommon->like;
+ $this->join = $this->bocommon->join;
+ $this->like = $this->bocommon->like;
}
function read($data)
@@ -55,20 +55,20 @@
}
else
{
- $ordermethod = ' order by account_lastname asc';
+ $ordermethod = ' order by name asc';
}
- $table = 'phpgw_accounts';
+ $table = 'hrm_job';
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
- $querymethod = " AND account_firstname
$this->like '%$query%' or account_lastname $this->like '%$query%'";
+ $querymethod = " WHERE name $this->like
'%$query%'";
}
- $sql = "SELECT * FROM $table WHERE account_type = 'u'
$querymethod";
+ $sql = "SELECT * FROM $table $querymethod";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
@@ -84,84 +84,23 @@
while ($this->db->next_record())
{
- $account_info[] = array
+ $job_info[] = array
(
- 'account_id' =>
$this->db->f('account_id'),
- 'account_firstname' =>
stripslashes($this->db->f('account_firstname')),
- 'account_lastname' =>
stripslashes($this->db->f('account_lastname'))
+ 'id' => $this->db->f('id'),
+ 'level' =>
(int)$this->db->f('job_level'),
+ 'name' =>
stripslashes($this->db->f('name')),
+ 'descr' =>
stripslashes($this->db->f('descr'))
);
}
- return $account_info;
+ return $job_info;
}
- function select_table($type,$type_id)
+ function read_single_job($id)
{
- switch($type)
- {
- case 'dim_d':
- $table='fm_dim_d';
- break;
- case 'tender_chapter':
- $table='fm_chapter';
- break;
- case 'ticket':
- $table='fm_tts_category';
- break;
- case 'request':
- $table='fm_request_category';
- break;
- case 'wo':
- $table='fm_workorder_category';
- break;
- case 'location':
- $table='fm_location' . $type_id .
'_category';
- break;
- case 'meter':
- $table='fm_meter_category';
- break;
- case 'document':
- $table='fm_document_category';
- break;
- case 'owner':
- $table='fm_owner_category';
- break;
- case 'tenant':
- $table='fm_tenant_category';
- break;
- case 'vendor':
- $table='fm_vendor_category';
- break;
- case 'district':
- $table='fm_district';
- break;
- case 'street':
- $table='fm_streetaddress';
- break;
- case 's_agreement':
- $table='fm_s_agreement_category';
- break;
- case 'tenant_claim':
- $table='fm_tenant_claim_category';
- break;
- case 'wo_hours':
- $table='fm_wo_hours_category';
- break;
- case 'r_condition_type':
- $table='fm_request_condition_type';
- break;
- }
-
- return $table;
- }
-
-
- function read_single($id,$type,$type_id)
- {
-
- $table = $this->select_table($type,$type_id);
+ $table = 'hrm_job';
$sql = "SELECT * FROM $table where id='$id'";
@@ -169,23 +108,49 @@
if ($this->db->next_record())
{
- $category['id'] = $this->db->f('id');
- $category['descr'] =
stripslashes($this->db->f('descr'));
+ $job['id'] = $id;
+ $job['parent_id'] =
(int)$this->db->f('job_parent');
+ $job['entry_date'] =
$this->db->f('entry_date');
+ $job['name'] =
stripslashes($this->db->f('name'));
+ $job['descr'] =
stripslashes($this->db->f('descr'));
- return $category;
+ return $job;
}
}
- function add($category,$type,$type_id)
+ function add_job($values)
{
- $table = $this->select_table($type,$type_id);
+ $table = 'hrm_job';
- $category['descr'] =
$this->db->db_addslashes($category['descr']);
+ if($values['parent_id'])
+ {
+ $this->db->query("SELECT job_level FROM $table
where id=" . intval($values['parent_id']),__LINE__,__FILE__);
+ $this->db->next_record();
+ $level = (int)$this->db->f('job_level') +1;
+ }
+ $values['name'] =
$this->db->db_addslashes($values['name']);
+ $values['descr'] =
$this->db->db_addslashes($values['descr']);
- $this->db->query("INSERT INTO $table (id, descr) "
- . "VALUES ('" . $category['id'] . "','" .
$category['descr']. "')",__LINE__,__FILE__);
+ $insert_values=array(
+ $values['name'],
+ $values['descr'],
+ $values['parent_id'],
+ $level,
+ time(),
+ $this->account
+ );
- $receipt['message'][]=array('msg'=>lang('category has
been saved'));
+ $insert_values =
$this->bocommon->validate_db_insert($insert_values);
+
+
+ $this->db->query("INSERT INTO $table
(name,descr,job_parent,job_level,entry_date,owner) "
+ . "VALUES ($insert_values)",__LINE__,__FILE__);
+
+ $receipt['message'][]=array('msg'=>lang('job has been
saved'));
+
+ $receipt['id'] =
$this->db->get_last_insert_id($table,'id');
+
+ $this->db->transaction_commit();
return $receipt;
}
@@ -210,5 +175,20 @@
$this->db->query("DELETE FROM $table WHERE id='" . $id
. "'",__LINE__,__FILE__);
}
+
+ function select_job_list()
+ {
+ $this->db->query("SELECT * FROM hrm_job ORDER BY name
");
+
+ $i = 0;
+ while ($this->db->next_record())
+ {
+ $job[$i]['id'] = $this->db->f('id');
+ $job[$i]['name'] =
stripslashes($this->db->f('name'));
+ $i++;
+ }
+ return $job;
+ }
+
}
?>
====================================================
Index: hrm/inc/class.bojob.inc.php
diff -u hrm/inc/class.bojob.inc.php:1.1 hrm/inc/class.bojob.inc.php:1.2
--- hrm/inc/class.bojob.inc.php:1.1 Mon Nov 21 12:01:20 2005
+++ hrm/inc/class.bojob.inc.php Mon Nov 21 15:49:08 2005
@@ -102,7 +102,7 @@
{
$this->cat_id = $cat_id;
}
- if(array_key_exists('allrows',$_POST) ||
array_key_exists('allrows',$_GET))
+ if ($allrows)
{
$this->allrows = $allrows;
}
@@ -127,7 +127,6 @@
$this->sort = $data['sort'];
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
- $this->allrows = $data['allrows'];
}
@@ -139,24 +138,28 @@
return $account_info;
}
- function read_single($id,$type,$type_id)
+ function read_single_job($id)
{
- return $this->so->read_single($id,$type,$type_id);
+ return $this->so->read_single_job($id);
}
- function save($category,$action='',$type ='',$type_id)
+ function save_job($values,$action='')
{
if ($action=='edit')
{
- if ($category['id'] != '')
+ if ($values['id'] != '')
{
- $receipt =
$this->so->edit($category,$type,$type_id);
+ $receipt = $this->so->edit_job($values);
+ }
+ else
+ {
+
$receipt['error'][]=array('msg'=>lang('Error'));
}
}
else
{
- $receipt =
$this->so->add($category,$type,$type_id);
+ $receipt = $this->so->add_job($values);
}
return $receipt;
@@ -166,5 +169,37 @@
{
$this->so->delete($id,$type,$type_id);
}
+
+ function select_job_list($selected='')
+ {
+ $jobs= $this->so->select_job_list();
+
+ while (is_array($jobs) && list(,$job) = each($jobs))
+ {
+ $sel_job = '';
+ if ($job['id']==$selected)
+ {
+ $sel_job = 'selected';
+ }
+
+ $job_list[] = array
+ (
+ 'id' => $job['id'],
+ 'name' => $job['name'],
+ 'selected' => $sel_job
+ );
+ }
+
+ for ($i=0;$i<count($job_list);$i++)
+ {
+ if ($job_list[$i]['selected'] != 'selected')
+ {
+ unset($job_list[$i]['selected']);
+ }
+ }
+
+ return $job_list;
+ }
+
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] hrm/inc class.uiuser.inc.php, 1.2 class.uijob.inc.php, 1.2 class.bouser.inc.php, 1.2 class.sojob.inc.php, 1.2 class.bojob.inc.php, 1.2,
sigurdne <=