RCCWP_WritePostPage::FileInterface PHP 메소드

FileInterface() 공개 정적인 메소드

File Field
public static FileInterface ( $customField, $inputName, $groupCounter, $fieldCounter )
    public static function FileInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        global $mf_domain;
        $idField = RCCWP_WritePostPage::changeNameInput($inputName);
        $mf_post_id = apply_filters('mf_source_post_data', @$_REQUEST['post']);
        $customFieldId = '';
        $freshPageFolderName = dirname(plugin_basename(__FILE__));
        $requiredClass = "";
        if ($customField->required_field) {
            $requiredClass = "field_required";
        }
        if (isset($mf_post_id)) {
            $customFieldId = $customField->id;
            $value = esc_attr(RCCWP_CustomField::GetCustomFieldValues(true, $mf_post_id, $customField->name, $groupCounter, $fieldCounter));
            $path = MF_FILES_URI;
            $valueRelative = $value;
            $value = $path . $value;
        } else {
            $valueRelative = '';
        }
        // If the field is at right, set a constant width to the text box
        $field_group = RCCWP_CustomGroup::Get($customField->group_id);
        $urlInputSize = false;
        $is_canvas = 0;
        if ($field_group->at_right) {
            $urlInputSize = 5;
            $is_canvas = 1;
        }
        ?>
		
		<p class="error_msg_txt upload-msg" id="upload_progress_<?php 
        echo $idField;
        ?>
" style="display:none;"></p>
		<script type="text/javascript"> 
			//this script is for remove the  file  related  to the post (using ajax)
      //@todo is neccessary refactor remove_file, the audio type file and the type file use exactly the same function.

			remove_file = function(){
				if(confirm("<?php 
        _e('Are you sure?', $mf_domain);
        ?>
")){
					//get  the name to the file
          			pattern = /remove\-([a-z0-9\-\_]+)/i;
					id = jQuery(this).attr("id");
          			id = pattern.exec(id);
          			id = id[1];
					file = jQuery('#'+id).val();

					delete_field = jQuery('#magicfields_remove_files').val();
					if(delete_field != ''){
						jQuery('#magicfields_remove_files').val(delete_field+"|||"+file);
					}else{
						jQuery('#magicfields_remove_files').val(file);
					}

					// set the value to empty
					jQuery('#actions-'+id).empty();
					jQuery('#remove-'+id).empty();
					jQuery('#'+id).val("");
					jQuery('#'+id).closest(".mf-field").find(".ajax-upload-list").html('');
				}
			};


			jQuery(document).ready(function(){
				jQuery("#remove-<?php 
        echo $idField;
        ?>
").live('click',remove_file);
			});
		</script>
		
		<div class="mf-file-links">
		  <div id="photo_edit_link_<?php 
        echo $idField;
        ?>
"> 
		<?php 
        if ($valueRelative) {
            echo '<span id="actions-' . $idField . '"><a href="' . $value . '" target="_blank" class="mf-file-view">' . __("View Current", $mf_domain) . '</a></span>';
            echo '<a href="javascript:void(0);" id="remove-' . $idField . '" class="mf-file-delete">' . __("Delete", $mf_domain) . '</a>';
        }
        ?>
			</div>
		</div>
		<!-- /.mf-file-links -->
		
		<div class="mf_custom_field">	
		<input tabindex="3" 
			id="<?php 
        echo $idField;
        ?>
" 
			name="<?php 
        echo $inputName;
        ?>
" 
			type="hidden"
			class="<?php 
        echo $requiredClass;
        ?>
" 
			size="46"
			value="<?php 
        echo $valueRelative;
        ?>
"
			<?php 
        if ($customField->required_field) {
            echo 'validate="required:true"';
        }
        ?>
			/>
		
		<?php 
        include_once "RCCWP_SWFUpload.php";
        RCCWP_SWFUpload::Body($inputName, 0, $is_canvas, $urlInputSize);
        ?>
		</div>
		<?php 
        if ($customField->required_field) {
            ?>
			<div class="mf_message_error"><label for="<?php 
            echo $inputName;
            ?>
" class="error_magicfields error"><?php 
            _e("This field is required", $mf_domain);
            ?>
</label></div>
		<?php 
        }
    }

Usage Example

예제 #1
0
    function GetModuleSettings($blockID)
    {
        require_once "RCCWP_WritePostPage.php";
        // Retieve the settings for $blockID
        $moduleSettings = FlutterLayoutBlock::GetModuleSettingsByBlock($blockID);
        foreach ($moduleSettings->variables as $variable) {
            $variable->properties = array();
            $inputName = $variable->variable_name;
            $variableValue = $variable->value;
            ?>
					<label for="item3" class="checkbox"><?php 
            echo $variable->description;
            ?>
					<?php 
            switch ($variable->type) {
                case 'textbox':
                    $variable->properties['size'] = "";
                    RCCWP_WritePostPage::TextboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'multiline_textbox':
                    $variable->properties['height'] = "10";
                    $variable->properties['width'] = "10";
                    RCCWP_WritePostPage::MultilineTextboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'checkbox':
                    RCCWP_WritePostPage::CheckboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'checkbox_list':
                    //$variableValue = unserialize($variableValue);
                    RCCWP_WritePostPage::CheckboxListInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'radiobutton_list':
                    RCCWP_WritePostPage::RadiobuttonListInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'dropdown_list':
                    RCCWP_WritePostPage::DropdownListInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'listbox':
                    //$variableValue = unserialize($variableValue);
                    $variable->properties['size'] = "";
                    RCCWP_WritePostPage::ListboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'file':
                    RCCWP_WritePostPage::FileInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'image':
                    RCCWP_WritePostPage::PhotoInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'date':
                    $variable->properties['format'] = "m.d.y";
                    RCCWP_WritePostPage::DateInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'audio':
                    RCCWP_WritePostPage::AudioInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
            }
            ?>
				</label>
			<?php 
        }
    }
All Usage Examples Of RCCWP_WritePostPage::FileInterface