LinkAction.class.php
gehe zur Dokumentation dieser Datei00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00062 class LinkAction extends ObjectAction
00063 {
00064 var $link;
00065 var $defaultSubAction = 'prop';
00066
00070 function LinkAction()
00071 {
00072 if ( $this->getRequestId() != 0 )
00073 {
00074 $this->link = new Link( $this->getRequestId() );
00075 $this->link->load();
00076 Session::setObject( $this->link );
00077 }
00078 else
00079 {
00080 $this->link = Session::getObject();
00081 }
00082 }
00083
00084
00085
00086 function remove()
00087 {
00088 $this->setTemplateVars( $this->link->getProperties() );
00089 }
00090
00091
00092
00093 function delete()
00094 {
00095 if ( $this->hasRequestVar("delete") )
00096 {
00097 $this->link->delete();
00098 $this->addNotice('link',$this->link->name,'DELETED');
00099 }
00100 }
00101
00102
00103
00107 function saveprop()
00108 {
00109
00110 if ( $this->getRequestVar('name') != '' )
00111 {
00112
00113 $this->link->name = $this->getRequestVar('name' );
00114 $this->link->desc = $this->getRequestVar('description');
00115
00116 $this->link->save();
00117 $this->link->setTimestamp();
00118 Session::setObject( $this->link );
00119 }
00120 }
00121
00122
00126 function save()
00127 {
00128 if( $this->getRequestVar('type') != '' )
00129 {
00130 if ( $this->getRequestVar('type') == 'link' )
00131 {
00132 $this->link->isLinkToObject = true;
00133 $this->link->isLinkToUrl = false;
00134 $this->link->linkedObjectId = $this->getRequestVar('targetobjectid');
00135 }
00136 else
00137 {
00138 $this->link->isLinkToObject = false;
00139 $this->link->isLinkToUrl = true;
00140 $this->link->url = $this->getRequestVar('url');
00141 }
00142
00143 $this->link->save();
00144 $this->link->setTimestamp();
00145 Session::setObject( $this->link );
00146 }
00147 }
00148
00149
00150 function showprop()
00151 {
00152 $this->setTemplateVars( $this->link->getProperties() );
00153 }
00154
00155
00156
00157 function edit()
00158 {
00159 $this->setTemplateVars( $this->link->getProperties() );
00160
00161
00162 $this->setTemplateVar('type' ,$this->link->getType() );
00163 $this->setTemplateVar('targetobjectid',$this->link->linkedObjectId);
00164 $this->setTemplateVar('url' ,$this->link->url );
00165
00166
00167 $list = array();
00168
00169 foreach( Object::getAllObjectIds() as $oid )
00170 {
00171 $o = new Object( $oid );
00172 $o->load();
00173
00174 if ( $o->isFile ||
00175 $o->isPage )
00176 {
00177 $folder = new Folder( $o->parentid );
00178 $folder->linknames = false;
00179 $folder->load();
00180 $list[$oid] = lang( 'GLOBAL_'.$o->getType() ).': ';
00181 $list[$oid] .= implode( FILE_SEP,$folder->parentObjectNames( false,true ) );
00182 $list[$oid] .= FILE_SEP.$o->name;
00183 }
00184 }
00185 asort( $list );
00186 $this->setTemplateVar('objects',$list);
00187
00188 $this->forward('link_edittarget');
00189 }
00190
00191
00192
00193 function prop()
00194 {
00195 $this->setTemplateVars( $this->link->getProperties() );
00196 $this->setTemplateVar('act_linkobjectid',$this->link->linkedObjectId);
00197 }
00198 }