00001 <?php if(!function_exists('startedIndexPhp')) { header("location:../index.php"); exit();}
00002 # streber - a php5 based project management system (c) 2005-2007 / www.streber-pm.org
00003 # Distributed under the terms and conditions of the GPL as stated in lang/license.html
00004
00005
00006
00025 class Employment extends DbProjectItem {
00026 public $name;
00027 public $project;
00028
00032 function __construct ($id_or_array=NULL)
00033 {
00034 global $g_employment_fields;
00035 $this->fields= &$g_employment_fields;
00036
00037 parent::__construct($id_or_array);
00038 if(!$this->type) {
00039 $this->type= ITEM_EMPLOYMENT;
00040 }
00041 }
00042
00043
00044 static function initFields()
00045 {
00046
00047 global $g_employment_fields;
00048 $g_employment_fields=array();
00049
00050
00051 addProjectItemFields(&$g_employment_fields);
00052
00053 foreach(array(
00054 new FieldInternal(array( 'name'=>'id',
00055 'default'=>0,
00056 'in_db_object'=>1,
00057 'in_db_item'=>1,
00058 )),
00059 new FieldInternal(array( 'name'=>'person',
00060 )),
00061 new FieldInternal(array( 'name'=>'company',
00062 )),
00063 new FieldString(array( 'name'=>'comment',
00064 )),
00065 ) as $f) {
00066 $g_employment_fields[$f->name]=$f;
00067 }
00068 }
00069
00075 static function getById($id)
00076 {
00077 $e= new Employment($id);
00078 if($e->id) {
00079 return $e;
00080 }
00081 return NULL;
00082 }
00083
00087 static function getEditableById($id)
00088 {
00089 global $auth;
00090 if($auth->cur_user->user_rights & RIGHT_COMPANY_EDIT) {
00091 return Employment::getById($id);
00092 }
00093 return NULL;
00094 }
00095 }
00096
00097 Employment::initFields();
00098
00099
00100 ?>