[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/view/admin/admineditlinkview.class.php") ; 4 lt_include( PLOG_CLASS_PATH."class/view/admin/adminlinkslistview.class.php") ; 5 lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/dao/mylinks.class.php" ); 8 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 9 10 /** 11 * \ingroup Action 12 * @private 13 * 14 * Action that shows a form to change the settings of the link 15 */ 16 class AdminEditLinkAction extends AdminAction 17 { 18 var $_linkId; 19 20 /** 21 * Constructor. If nothing else, it also has to call the constructor of the parent 22 * class, BlogAction with the same parameters 23 */ 24 function AdminEditLinkAction( $actionInfo, $request ) 25 { 26 $this->AdminAction( $actionInfo, $request ); 27 28 // data validation stuff 29 $this->registerFieldValidator( "linkId", new IntegerValidator()); 30 // we need to register the other fields or else the form validation will complain 31 $this->_form->registerField( "linkDescription" ); 32 $this->_form->registerField( "linkName" ); 33 $this->_form->registerField( "linkRssFeed" ); 34 $this->_form->registerField( "linkUrl" ); 35 $view = new AdminLinksListView( $this->_blogInfo ); 36 $view->setErrorMessage( $this->_locale->tr("error_fetching_link" )); 37 $this->setValidationErrorView( $view ); 38 39 // permission checks 40 $this->requirePermission( "update_link" ); 41 } 42 43 /** 44 * Carries out the specified action 45 */ 46 function perform() 47 { 48 // fetch the link 49 $this->_linkId = $this->_request->getValue( "linkId" ); 50 $links = new MyLinks(); 51 $link = $links->getMyLink( $this->_linkId, $this->_blogInfo->getId()); 52 // show an error if we couldn't fetch the link 53 if( !$link ) { 54 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_link")); 55 $this->setCommonData(); 56 57 return false; 58 } 59 60 $this->notifyEvent( EVENT_LINK_LOADED, Array( "link" => &$link )); 61 62 // otherwise show the form to edit its fields 63 $this->_view = new AdminEditLinkView( $this->_blogInfo ); 64 $this->_view->setValue( "linkName", $link->getName()); 65 $this->_view->setValue( "linkDescription", $link->getDescription()); 66 $this->_view->setValue( "linkUrl", $link->getUrl()); 67 $this->_view->setValue( "linkRssFeed", $link->getRssFeed()); 68 $this->_view->setValue( "linkId", $link->getId()); 69 $this->_view->setValue( "linkCategoryId", $link->getCategoryId()); 70 $this->setCommonData(); 71 72 // better to return true if everything fine 73 return true; 74 } 75 } 76 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |