| [ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/dao/customfields/customfields.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/view/admin/admincustomfieldslistview.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 8 9 /** 10 * \ingroup Action 11 * @private 12 * 13 * Allows users to edit custom fields 14 */ 15 class AdminEditCustomFieldAction extends AdminAction 16 { 17 18 var $_fieldId; 19 20 function AdminEditCustomFieldAction( $actionInfo, $request ) 21 { 22 $this->AdminAction( $actionInfo, $request ); 23 24 // validate data 25 $this->registerFieldValidator( "fieldId", new IntegerValidator()); 26 $view = new AdminCustomFieldsListView( $this->_blogInfo ); 27 $view->setErrorMessage( $this->_locale->tr( "error_fetching_custom_field" )); 28 $this->setValidationErrorView( $view ); 29 // dummy validation data 30 $this->_form->registerField( "fieldName" ); 31 $this->_form->registerField( "fieldDescription" ); 32 $this->_form->registerField( "fieldType" ); 33 $this->_form->registerField( "fieldSearchable" ); 34 $this->_form->registerField( "fieldHidden" ); 35 $this->_form->registerField( "fieldValues" ); 36 37 $this->requirePermission( "update_custom_field" ); 38 } 39 40 /** 41 * Carries out the specified action 42 */ 43 function perform() 44 { 45 // fetch the field information 46 $this->_fieldId = $this->_request->getValue( "fieldId" ); 47 $fields = new CustomFields(); 48 $field = $fields->getCustomField( $this->_fieldId ); 49 50 // show an error if we couldn't fetch the link 51 if( !$field ) { 52 $this->_view = new AdminCustomFieldsListView( $this->_blogInfo ); 53 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_custom_field")); 54 } 55 else { 56 // fire the field loaded event, in case any plugin wants to do anything with it... 57 $this->notifyEvent( EVENT_CUSTOM_FIELD_LOADED, Array( "field" => &$field )); 58 59 $this->_view = new AdminTemplatedView( $this->_blogInfo, "editcustomfield" ); 60 $this->_view->setValue( "fieldName", $field->getName()); 61 $this->_view->setValue( "fieldDescription", $field->getDescription()); 62 $this->_view->setValue( "fieldId", $field->getId()); 63 $this->_view->setValue( "fieldType", $field->getType()); 64 $this->_view->setValue( "fieldSearchable", true ); 65 $this->_view->setValue( "fieldHidden", $field->isHidden()); 66 $this->_view->setValue( "fieldValues", $field->getFieldValues()); 67 } 68 69 $this->setCommonData(); 70 71 // better to return true if everything fine 72 return true; 73 } 74 } 75 ?>
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 |
|