DropdownListInterface() public static method

public static DropdownListInterface ( $customField, $inputName, $groupCounter, $fieldCounter )
Beispiel #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 
        }
    }
    /**
     * @todo Add documentation
     */
    function CustomFieldInterface($customFieldId, $groupCounter = 1, $fieldCounter = 1, $customGroup_id = 0)
    {
        global $mf_domain;
        require_once "RC_Format.php";
        $customField = RCCWP_CustomField::Get($customFieldId);
        $customFieldName = RC_Format::GetInputName(attribute_escape($customField->name));
        $customFieldTitle = attribute_escape($customField->description);
        $customFieldHelp = htmlentities2($customField->help_text);
        $groupId = $customGroup_id;
        $inputName = $customFieldId . "_" . $groupCounter . "_" . $fieldCounter . "_" . $groupId . "_" . $customFieldName;
        // Create input tag name
        if ($fieldCounter > 1 && $customField->duplicate == 0) {
            return;
        }
        if ($fieldCounter > 1) {
            $titleCounter = " ({$fieldCounter})";
        }
        $field_group = RCCWP_CustomGroup::Get($customField->group_id);
        ?>
		<div class="mf-field <?php 
        echo str_replace(" ", "_", $customField->type);
        ?>
" id="row_<?php 
        echo $inputName;
        ?>
">
			<label for="<?php 
        echo $inputName;
        ?>
">
				<?php 
        if (empty($titleCounter)) {
            $titleCounter = "";
        }
        ?>
				<?php 
        echo $customFieldTitle . $titleCounter;
        ?>
				<?php 
        if (!empty($customFieldHelp)) {
            ?>
					<small class="tip">(what's this?)<span class="field_help"><?php 
            echo $customFieldHelp;
            ?>
</span></small>
				<?php 
        }
        ?>
			</label>
			<span>
				<p class="error_msg_txt" id="fieldcellerror_<?php 
        echo $inputName;
        ?>
" style="display:none"></p>
				<?php 
        switch ($customField->type) {
            case 'Textbox':
                RCCWP_WritePostPage::TextboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Multiline Textbox':
                RCCWP_WritePostPage::MultilineTextboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Checkbox':
                RCCWP_WritePostPage::CheckboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Checkbox List':
                RCCWP_WritePostPage::CheckboxListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Radiobutton List':
                RCCWP_WritePostPage::RadiobuttonListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Dropdown List':
                RCCWP_WritePostPage::DropdownListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Listbox':
                RCCWP_WritePostPage::ListboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'File':
                RCCWP_WritePostPage::FileInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Image':
                RCCWP_WritePostPage::PhotoInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Date':
                RCCWP_WritePostPage::DateInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Audio':
                RCCWP_WritePostPage::AudioInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Color Picker':
                RCCWP_WritePostPage::ColorPickerInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Slider':
                RCCWP_WritePostPage::SliderInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
                //eeble
            //eeble
            case 'Related Type':
                RCCWP_WritePostPage::RelatedTypeInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            default:
        }
        if ($fieldCounter == 1) {
            ?>
					<?php 
            if ($customField->duplicate != 0) {
                ?>
					<br />
					
					 <a class ="typeHandler" href="javascript:void(0);" id="type_handler-<?php 
                echo $inputName;
                ?>
" > 
						<img class="duplicate_image"  src="<?php 
                echo MF_URI;
                ?>
images/duplicate.png" alt="<?php 
                _e('Add field duplicate', $mf_domain);
                ?>
"/>  <?php 
                _e('Duplicate', $mf_domain);
                ?>
					</a>
					<?php 
            }
            ?>
					<?php 
        } else {
            ?>
					<br />
					<a class ="delete_duplicate_field" href="javascript:void(0)" id="delete_field_repeat-<?php 
            echo $inputName;
            ?>
"> 
						<img class="duplicate_image"  src="<?php 
            echo MF_URI;
            ?>
images/delete.png" alt="<?php 
            _e('Remove field duplicate', $mf_domain);
            ?>
 "/> <?php 
            _e('Remove', $mf_domain);
            ?>
 
					</a>
				<?php 
        }
        ?>
				<input type="hidden" name="rc_cwp_meta_keys[]" value="<?php 
        echo $inputName;
        ?>
" />
		</span>
		</div>
	<?php 
    }
    /**
     * @todo Add documentation
     */
    public static function CustomFieldInterface($customFieldId, $groupCounter = 1, $fieldCounter = 1, $customGroup_id = 0)
    {
        global $mf_domain;
        require_once "RC_Format.php";
        $customField = RCCWP_CustomField::Get($customFieldId);
        $customFieldName = $customField->name;
        $customFieldTitle = esc_attr($customField->description);
        $customFieldHelp = $customField->help_text;
        // htmlentities($customField->help_text,ENT_COMPAT,'UTF-8');
        $groupId = $customGroup_id;
        $inputCustomName = $customFieldId . "_" . $groupCounter . "_" . $fieldCounter . "_" . $groupId . "_" . $customFieldName;
        // Create input tag name
        $inputName = "magicfields[{$customFieldName}][{$groupCounter}][{$fieldCounter}]";
        if ($fieldCounter > 1 && $customField->duplicate == 0) {
            return;
        }
        if ($fieldCounter > 1) {
            $titleCounter = " (<span class='counter_{$customFieldName}_{$groupCounter}'>{$fieldCounter}</span>)";
        }
        $field_group = RCCWP_CustomGroup::Get($customField->group_id);
        /* 
         * Add the lang attribute if last part of the field name matches defined languages
         * 
         * define( 'ADMIN_LANGS', 'en|fr|de' );
         * example: field name 'the_about_text_en' matches 'en' and sets ' lang="en"'
         *
         */
        if (defined('ADMIN_LANGS')) {
            $customFieldNameParts = explode('_', $customFieldName);
            $lang_switch = preg_match('/' . ADMIN_LANGS . '/', $customFieldNameParts[sizeof($customFieldNameParts) - 1]) ? ' lang="' . $customFieldNameParts[sizeof($customFieldNameParts) - 1] . '"' : '';
        } else {
            $lang_switch = '';
        }
        if (isset($customField->properties['strict-max-length']) && $customField->properties['strict-max-length'] == 1) {
            $fieldMaxLengthClass = ' maxlength';
        } else {
            $fieldMaxLengthClass = '';
        }
        $fieldCustomClass = "mf-field-{$customFieldName}";
        // allows some special styling in wordpress filters
        $duplicateClass = "";
        if ($fieldCounter > 1) {
            $duplicateClass = "mf-field-duplicate";
        }
        ?>
		<div class="mf-field <?php 
        echo $duplicateClass;
        ?>
 <?php 
        echo $fieldCustomClass;
        ?>
 mf-t-<?php 
        echo strtolower(str_replace(" ", "-", $customField->type));
        ?>
 <?php 
        echo str_replace(" ", "_", $customField->type);
        echo $fieldMaxLengthClass;
        ?>
" id="row_<?php 
        echo $inputCustomName;
        ?>
"<?php 
        echo $lang_switch;
        ?>
>
			<div class="mf-field-title">
			<label for="<?php 
        echo $inputCustomName;
        ?>
">
				<?php 
        if (empty($titleCounter)) {
            $titleCounter = "";
        }
        ?>
				<span class="name"><?php 
        echo $customFieldTitle;
        ?>
<em><?php 
        echo $titleCounter;
        ?>
</em></span>
				<?php 
        if ($customField->required_field == 1) {
            ?>
 <span class="required">*</span><?php 
        }
        if (!empty($customFieldHelp)) {
            ?>
					<small class="tip"><?php 
            _e("what's this?", $mf_domain);
            ?>
<span class="field_help"><?php 
            echo $customFieldHelp;
            ?>
</span></small>
				<?php 
        }
        if (isset($customField->properties['strict-max-length']) && $customField->properties['strict-max-length'] == 1) {
            if ($customField->type == 'Multiline Textbox') {
                $charsRemainingSize = $customField->properties['height'] * $customField->properties['width'];
            } else {
                $charsRemainingSize = $customField->properties['size'];
            }
            ?>
<small class="remaining"><?php 
            _e('Characters left', $mf_domain);
            ?>
: <span class="charsRemaining" title="<?php 
            _e('Characters left', $mf_domain);
            ?>
"><?php 
            echo $charsRemainingSize;
            ?>
</span></small><?php 
        }
        ?>
			</label>
			</div>
			<!-- /.mf-field-title -->
			
			<div>
				<p class="error_msg_txt" id="fieldcellerror_<?php 
        echo $inputCustomName;
        ?>
" style="display:none"></p>
				<?php 
        switch ($customField->type) {
            case 'Textbox':
                RCCWP_WritePostPage::TextboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Multiline Textbox':
                RCCWP_WritePostPage::MultilineTextboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Checkbox':
                RCCWP_WritePostPage::CheckboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Checkbox List':
                RCCWP_WritePostPage::CheckboxListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Radiobutton List':
                RCCWP_WritePostPage::RadiobuttonListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Dropdown List':
                RCCWP_WritePostPage::DropdownListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Listbox':
                RCCWP_WritePostPage::ListboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'File':
                RCCWP_WritePostPage::FileInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Image':
                RCCWP_WritePostPage::PhotoInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Date':
                RCCWP_WritePostPage::DateInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Audio':
                RCCWP_WritePostPage::AudioInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Color Picker':
                RCCWP_WritePostPage::ColorPickerInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Slider':
                RCCWP_WritePostPage::SliderInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Related Type':
                RCCWP_WritePostPage::RelatedTypeInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Markdown Textbox':
                RCCWP_WritePostPage::MarkdownTextboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Image (Upload Media)':
                RCCWP_WritePostPage::MediaPhotoInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            default:
        }
        ?>
				
				<div class="mf-duplicate-controls">
			  <?php 
        $cfd = Inflect::singularize($customField->description);
        if ($fieldCounter == 1) {
            ?>
					<?php 
            if ($customField->duplicate != 0) {
                ?>
            <a href="javascript:void(0);" id="type_handler-<?php 
                echo $inputCustomName;
                ?>
" class="typeHandler duplicate_field"><span><?php 
                _e('Add Another', $mf_domain);
                ?>
</span> <?php 
                echo $cfd;
                ?>
</a>
					<?php 
            }
            ?>
					<?php 
        } else {
            ?>
					<a class="delete_duplicate_field" href="javascript:void(0)" id="delete_field_repeat-<?php 
            echo $inputCustomName;
            ?>
"><span><?php 
            _e('Remove', $mf_domain);
            ?>
</span> <?php 
            echo $cfd;
            ?>
</a>
				<?php 
        }
        ?>
  		  </div>
  		  <!-- ./title-controls -->
		</div>
		</div>
	<?php 
    }
    /**
     * This function show the panel for 
     * add new panels and change his values
     *
     * @author David Valdez <*****@*****.**>
     *
     */
    function Main()
    {
        global $wpdb, $flutter_domain;
        //FlutterLayoutBlock::UpdateModuleSettings(get_template_directory().'/configure.xml', -1, '-', get_option('template'));
        $template = get_option('template');
        $template_module_id = $wpdb->get_var("SELECT module_id  FROM " . FLUTTER_TABLE_LAYOUT_MODULES . " WHERE theme = '{$template}'");
        $moduleSettings = FlutterLayoutBlock::GetModuleSettings($template_module_id);
        if (!$moduleSettings) {
            die(__('This theme has no settings', $flutter_domain));
        }
        if (isset($_POST['_savesetttings'])) {
            foreach ($moduleSettings->variables as $varKey => $variable) {
                $moduleSettings->variables[$varKey]->value = $_POST[$variable->variable_name];
            }
            $moduleSettings->SaveValues();
        }
        ?>
		
		<script type="text/javascript">
			var wp_root         = "<?php 
        echo get_bloginfo('wpurl');
        ?>
";
		</script>
		<script type="text/javascript" src="<?php 
        echo FLUTTER_URI;
        ?>
js/ui.core.js"></script>
		<div class="wrap">
		<h2><?php 
        _e('Flutter Theme Settings', $flutter_domain);
        ?>
</h2>
		<input type='hidden' id='editorcontainer'/>
		<form name="themesettings_form" action="?page=Flutter_ThemeSettings" id="themesettings_form" method="post">
		<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
		<?php 
        foreach ($moduleSettings->variables as $variable) {
            $variable->properties = array();
            $inputName = $variable->variable_name;
            $variableValue = $variable->value;
            ?>
			<tr valign="top">
				<th scope="row"><?php 
            echo $variable->description;
            ?>
</th>
				<td>
				<?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':
                    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':
                    $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;
                case 'Color Picker':
                    RCCWP_WritePostPage::ColorPickerInterface($customField, $inputName, 0, 0, $variableValue);
                    break;
                case 'Slider':
                    RCCWP_WritePostPage::SliderInterface($customField, $inputName, 0, 0, $variableValue);
                    break;
            }
            ?>
				</td>
			</tr>
		<?php 
        }
        ?>
		
		</table>
		
		<p class="submit" ><input name="_savesetttings" type="submit" value="<?php 
        _e('Save Settings', $flutter_domain);
        ?>
" /></p>
		</form>
		</div>
		<?php 
    }
Beispiel #5
0
    function CustomFieldInterface($customFieldId, $groupCounter = 1, $fieldCounter = 1, $customGroup_id = 0)
    {
        global $flutter_domain;
        require_once "RC_Format.php";
        $customField = RCCWP_CustomField::Get($customFieldId);
        $customFieldName = RC_Format::GetInputName(attribute_escape($customField->name));
        $customFieldTitle = attribute_escape($customField->description);
        $groupId = $customGroup_id;
        $inputName = $customFieldId . "_" . $groupCounter . "_" . $fieldCounter . "_" . $groupId . "_" . $customFieldName;
        // Create input tag name
        if ($fieldCounter > 1 && $customField->duplicate == 0) {
            return;
        }
        if ($fieldCounter > 1) {
            $titleCounter = " ({$fieldCounter})";
        }
        $field_group = RCCWP_CustomGroup::Get($customField->group_id);
        ?>
		<tr class="form-field" id="row_<?php 
        echo $inputName;
        ?>
">
			<?php 
        // If the field is at right, put the header over the field
        if ($field_group->at_right) {
            ?>
			<td>
				<label style="font-weight:bold" for="<?php 
            echo $inputName;
            ?>
"><?php 
            echo $customFieldTitle . $titleCounter;
            ?>
</label>
				<br />
			<?php 
        } else {
            ?>
			<th valign="top" scope="row">
				<label for="<?php 
            echo $inputName;
            ?>
"><?php 
            echo $customFieldTitle . $titleCounter;
            ?>
</label>
			</th>
			<td>
			<?php 
        }
        ?>
				
				<p class="error_msg_txt" id="fieldcellerror_<?php 
        echo $inputName;
        ?>
" style="display:none"></p>
				<?php 
        switch ($customField->type) {
            case 'Textbox':
                RCCWP_WritePostPage::TextboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Multiline Textbox':
                RCCWP_WritePostPage::MultilineTextboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Checkbox':
                RCCWP_WritePostPage::CheckboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Checkbox List':
                RCCWP_WritePostPage::CheckboxListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Radiobutton List':
                RCCWP_WritePostPage::RadiobuttonListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Dropdown List':
                RCCWP_WritePostPage::DropdownListInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Listbox':
                RCCWP_WritePostPage::ListboxInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'File':
                RCCWP_WritePostPage::FileInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Image':
                RCCWP_WritePostPage::PhotoInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Date':
                RCCWP_WritePostPage::DateInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Audio':
                RCCWP_WritePostPage::AudioInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Color Picker':
                RCCWP_WritePostPage::ColorPickerInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            case 'Slider':
                RCCWP_WritePostPage::SliderInterface($customField, $inputName, $groupCounter, $fieldCounter);
                break;
            default:
        }
        if ($fieldCounter == 1) {
            ?>
					<?php 
            if ($customField->duplicate != 0) {
                ?>
					<br />
					
					 <a class ="typeHandler" href="javascript:void(0);" id="type_handler-<?php 
                echo $inputName;
                ?>
" > 
						<img class="duplicate_image"  src="<?php 
                echo FLUTTER_URI;
                ?>
images/duplicate.png" alt="<?php 
                _e('Add field duplicate', $flutter_domain);
                ?>
"/>  <?php 
                _e('Duplicate', $flutter_domain);
                ?>
					</a>
					<?php 
            }
            ?>
					 
					<?php 
        } else {
            ?>
					<br />
					
					<a class ="delete_duplicate_field" href="javascript:void(0)" id="delete_field_repeat-<?php 
            echo $inputName;
            ?>
"> 
						<img class="duplicate_image"  src="<?php 
            echo FLUTTER_URI;
            ?>
images/delete.png" alt="<?php 
            _e('Remove field duplicate', $flutter_domain);
            ?>
 "/> <?php 
            _e('Remove', $flutter_domain);
            ?>
 
					</a>
				<?php 
        }
        ?>
				<input type="hidden" name="rc_cwp_meta_keys[]" value="<?php 
        echo $inputName;
        ?>
" />
			</td>
		</tr>
	<?php 
    }