00001 <?php if(!function_exists('startedIndexPhp')) { header("location:../index.php"); exit();}
00002 # streber - a php based project management system
00003 # Copyright (c) 2005 Thomas Mann - thomas@pixtur.de
00004 # Distributed under the terms and conditions of the GPL as stated in docs/license.txt
00005
00017 class ListBlock_companies extends ListBlock
00018 {
00019
00020 public $format;
00021
00022 public function __construct($args=NULL)
00023 {
00024 parent::__construct($args);
00025
00026 $this->id ='companies';
00027 $this->bg_style ='bg_people';
00028 $this->title =__("related companies");
00029
00030 $this->add_col( new ListBlockColSelect());
00031 $this->add_col( new ListBlockColFormat(array(
00032 'key'=>'short',
00033 'name'=>__("Name Short"),
00034 'tooltip'=>__("Shortnames used in other lists"),
00035 'sort'=>0,
00036 'format'=>'<nobr><a href="index.php?go=companyView&company={?id}">{?short}</a></nobr>'
00037 )));
00038 $this->add_col( new ListBlockCol_CompanyName());
00039 $this->add_col( new ListBlockColFormat(array(
00040 'key'=>'phone',
00041 'name'=>__("Phone"),
00042 'tooltip'=>__("Phone-Number"),
00043 'format'=>'<nobr>{?phone}</nobr>'
00044 )));
00045 $this->add_col( new ListBlockColLinkExtern(array(
00046 'key'=>'homepage',
00047 'name'=>"Homepage",
00048 )));
00049 $this->add_col( new ListBlockColMethod(array(
00050 'name'=>__("Proj"),
00051 'tooltip'=>__("Number of open Projects"),
00052 'func'=>'getNumOpenProjects',
00053 'style'=>'right'
00054 )));
00055 $this->add_col( new ListBlockColMethod(array(
00056 'name'=>__("People"),
00057 'id'=>"people",
00058 'tooltip'=>__("People working for this person"),
00059 'sort'=>0,
00060 'style'=>'nowrap',
00061 'func'=>'getPersonLinks',
00062 )));
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 #---- functions ----
00088 global $PH;
00089 $this->add_function(new ListFunction(array(
00090 'target'=>$PH->getPage('companyEdit')->id,
00091 'name' =>__('Edit company'),
00092 'id' =>'companyEdit',
00093 'icon' =>'edit',
00094 'context_menu'=>'submit',
00095 )));
00096 $this->add_function(new ListFunction(array(
00097 'target'=>$PH->getPage('companyDelete')->id,
00098 'name' =>__('Delete company'),
00099 'id' =>'companyDelete',
00100 'icon' =>'delete'
00101 )));
00102 $this->add_function(new ListFunction(array(
00103 'target'=>$PH->getPage('companyNew')->id,
00104 'name' =>__('Create new company'),
00105 'id' =>'companyNew',
00106 'icon' =>'new',
00107 'context_menu'=>'submit',
00108 )));
00109 $this->add_function(new ListFunction(array(
00110 'target'=>$PH->getPage('itemsAsBookmark')->id,
00111 'name' =>__('Mark as bookmark'),
00112 'id' =>'itemsAsBookmark',
00113 'context_menu'=>'submit',
00114 )));
00115 }
00116 }
00117
00118
00119 class ListBlockCol_CompanyName extends ListBlockCol
00120 {
00121 public $key= 'name';
00122 public $width='90%';
00123
00124 public function __construct($args=NULL)
00125 {
00126 parent::__construct($args);
00127 $this->name=__('Company','Column header');
00128 #$this->id='name';
00129 }
00130
00131
00132 public function render_tr(&$obj, $style="")
00133 {
00134 global $PH;
00135
00136 if(!isset($obj) || !$obj instanceof Company) {
00137 return;
00138 }
00139
00140 $str= $PH->getLink('companyView',asHtml($obj->name), array('company'=>$obj->id),'item company',true);
00141 print "<td>$str</td>";
00142 }
00143 }
00144
00145
00146
00147
00148 ?>