RCCWP_WritePostPage::DateInterface PHP Method

DateInterface() public method

public DateInterface ( $customField, $inputName, $groupCounter, $fieldCounter )
    function DateInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        global $wpdb;
        $customFieldId = '';
        $mf_post_id = apply_filters('mf_source_post_data', @$_REQUEST['post']);
        $idField = RCCWP_WritePostPage::changeNameInput($inputName);
        if (isset($mf_post_id)) {
            $customFieldId = $customField->id;
            $value = esc_attr(RCCWP_CustomField::GetCustomFieldValues(true, $mf_post_id, $customField->name, $groupCounter, $fieldCounter));
            $raw_value = $value;
            if (!empty($value)) {
                $value = date($customField->properties['format'], strtotime($value));
            } else {
                $value = "";
                //date($customField->properties['format']);
            }
        } else {
            $value = "";
            //date($customField->properties['format']);
        }
        $dateFormat = $customField->properties['format'];
        $today = date($dateFormat);
        $field_group = RCCWP_CustomGroup::Get($customField->group_id);
        $inputSize = 25;
        if ($field_group->at_right) {
            $inputSize = 15;
        }
        ?>
		<div id="format_date_field_<?php 
        echo $idField;
        ?>
" style="display:none"><?php 
        echo $dateFormat;
        ?>
</div>
			
		<input 	id="display_date_field_<?php 
        echo $idField;
        ?>
"
		 		value="<?php 
        echo $value;
        ?>
" 
				type="text" 
				size="<?php 
        echo $inputSize;
        ?>
" 
				class="datepicker_mf"   
			  <?php 
        if ($customField->required_field) {
            echo 'validate="required:true"';
        }
        ?>
	
		readonly="readonly" />
		
		<input 	id="date_field_<?php 
        echo $idField;
        ?>
" 
				name="<?php 
        echo $inputName;
        ?>
" 
				value="<?php 
        echo $raw_value;
        ?>
" type="hidden" 
		/>
		<input 	type="button" 
				value="Pick..." 
				id="pick_<?php 
        echo $idField;
        ?>
" 
				class="datebotton_mf button" 
		/>
		<input 	type="button" 
				id="today_<?php 
        echo $idField;
        ?>
"
				value="Today" 
				class="todaybotton_mf button"
		/>
		<input 	type="button" 
				id="blank_<?php 
        echo $idField;
        ?>
"
				value="Blank" 
				class="blankBotton_mf button"
		/>
		<input 	type="hidden"
				value="<?php 
        echo $today;
        ?>
"
				id="tt_<?php 
        echo $idField;
        ?>
"
				class="todaydatebutton_mf button"
		/>
		<input 	type="hidden"
				value="<?php 
        echo date("Y-m-d");
        ?>
"
				id="tt_raw_<?php 
        echo $idField;
        ?>
"
		/>

		<input 
				type="hidden"
				name="rc_cwp_meta_date[]" 
				value="<?php 
        echo $idField;
        ?>
" 	
		/>
		<?php 
    }

Usage Example

コード例 #1
0
ファイル: FlutterLayout.php プロジェクト: mark2me/pressform
    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::DateInterface