Example #1
0
    function select($item)
    {
        extract($this->option_atts(array("default" => "", "styles" => ""), $item));
        $selected_value = isset($item['value']) ? $item['value'] : '';
        if (!$selected_value) {
            $selected_value = $default;
        }
        $class = isset($item['class']) ? $item['class'] : '';
        if ('icons' === $class) {
            $select_content = cws_print_fa_select($selected_value);
        } else {
            $select_content = '';
            foreach ($item['options'] as $option => $option_value) {
                $selected = $selected_value == $option ? ' selected="selected"' : '';
                $select_content .= '<option value="' . $option . '" ' . $selected . '>' . $option_value . '</option>';
            }
        }
        $style = empty($item['styles']) ? '' : 'style="' . $item['styles'] . '"';
        $select_description = isset($item['desc']) ? $item['desc'] : '';
        echo <<<SELECT
\t\t\t\t<div {$style}>
\t\t\t\t\t<select name="{$item['id']}" id="{$item['id']}" class="{$class}" data-type="select">
\t\t\t\t\t\t{$select_content}
\t\t\t\t\t</select>
\t\t\t\t\t<span class="select_box"></span>
\t\t\t\t\t<label>{$select_description}</label>
\t\t\t\t</div>
SELECT;
    }
Example #2
0
function dept_metabox_edit($tag)
{
    // check for assigned technical category should be added
    $display_none = ' style="display:none"';
    $org = get_option_value('cws-clinico-dept-org', $tag->term_id);
    $title_img = get_option_value('cws-clinico-dept-img', $tag->term_id);
    $thumb_url = $title_img ? '="' . wp_get_attachment_thumb_url($title_img) . '"' : '';
    ?>
	<tr class="form-field">
		<th scope="row" valign="top">
			<label for="cws-clinico-dept-org"><?php 
    _e('Organizer', THEME_SLUG);
    ?>
</label>
		</th><td>
			<textarea name="cws-clinico-dept-org" id="cws-clinico-dept-org" class="postform" rows="5" cols="40"><?php 
    echo $org;
    ?>
</textarea>
		</td>
	</tr>
	<tr class="form-field">
	<th scope="row" valign="top">
	<label for="cws-clinico-dept-img"><?php 
    _e('Select a Picture for this department', THEME_SLUG);
    ?>
</label>
	</th><td>
	<a id="media-dept-img" <?php 
    echo $title_img ? $display_none : '';
    ?>
><?php 
    _e('Click here to select image', THEME_SLUG);
    ?>
</a>
	<a id="remov-dept-img" <?php 
    echo !$title_img ? $display_none : '';
    ?>
><?php 
    _e('Remove this image', THEME_SLUG);
    ?>
</a>
	<input class="widefat" hidden readonly id="dept-img" name="cws-clinico-dept-img" type="text" value="<?php 
    echo $title_img;
    ?>
" />
	<img id="img-dept-img" src<?php 
    echo $thumb_url;
    ?>
 />
	</td></tr>
	<?php 
    $procedures = get_option_value('cws-clinico-dept-procedures', $tag->term_id);
    ?>
	<tr class="form-field">
	<th scope="row" valign="top">
	<label for="cws-clinico-dept-procedures"><?php 
    _e('Select Procedures for this department', THEME_SLUG);
    ?>
</label>
	</th><td>
	<select multiple name="cws-clinico-dept-procedures[]" id="cws-clinico-dept-procedures" class="postform" style="width:50%">
	<?php 
    echo cws_print_procedures_select($procedures);
    ?>
	</select>
	</td></tr>
	<?php 
    $events = get_option_value('cws-clinico-dept-events', $tag->term_id);
    ?>
	<tr class="form-field">
	<th scope="row" valign="top">
	<label for="cws-clinico-events"><?php 
    _e('Select Events associated with this department', THEME_SLUG);
    ?>
</label>
	</th><td>
	<select multiple name="cws-clinico-events[]" id="cws-clinico-events" class="postform" style="width:50%">
	<?php 
    echo cws_print_events_select($events);
    ?>
	</select>
	</td></tr>
	<?php 
    $fa_icon = get_option_value('cws-clinico-dept-fa', $tag->term_id);
    ?>
	<tr class="form-field">
	<th scope="row" valign="top">
	<label for="cws-clinico-dept-fa"><?php 
    _e('Icon', THEME_SLUG);
    ?>
</label>
	</th><td>
	<select name="cws-clinico-dept-fa" id="cws-clinico-dept-fa" class="postform" style="width:50%">
	<?php 
    echo cws_print_fa_select($fa_icon);
    ?>
	</select>
	</td></tr>
	<?php 
}
Example #3
0
function cws_widget_icon_selection($args)
{
    extract($args);
    ob_start();
    ?>
	<section class="icon-options" <?php 
    echo isset($show_icon_options) && $show_icon_options == "on" ? "" : $display_none;
    ?>
>
		<ul class="redux-image-select">
		<li class="redux-image-select <?php 
    echo $title_select == 'fa' ? 'selected' : '';
    ?>
">
			<input id="<?php 
    echo $_this->get_field_id('fa');
    ?>
" name="<?php 
    echo $_this->get_field_name('title_select');
    ?>
" type="radio" value="fa"  <?php 
    echo $title_select == 'fa' ? 'checked' : '';
    ?>
><i class="fa fa-flag fa-2x"></i></li>
		<li class="redux-image-select <?php 
    echo $title_select == 'img' ? 'selected' : '';
    ?>
">
			<input id="<?php 
    echo $_this->get_field_id('img');
    ?>
" name="<?php 
    echo $_this->get_field_name('title_select');
    ?>
" type="radio" value="img" <?php 
    echo $title_select == 'img' ? 'checked' : '';
    ?>
><i class="fa fa-picture-o fa-2x"></i></li>
		</ul>
		<div class='image-part'>
			<div class="img-wrapper" <?php 
    echo $title_select != 'fa' ? $display_none : '';
    ?>
>
				<select class="icons" placeholder="<?php 
    _e('Pick an icon for this widget', 'happykids');
    ?>
" data-placeholder="<?php 
    _e('Pick an icon for this widget', 'happykids');
    ?>
" name="<?php 
    echo $_this->get_field_name('title_fa');
    ?>
" id="<?php 
    echo $_this->get_field_id('title_fa');
    ?>
">
					<?php 
    echo cws_print_fa_select($title_fa);
    ?>
				</select>
			</div>
			<div class="img-wrapper" <?php 
    echo $title_select != 'img' ? $display_none : '';
    ?>
>
				<p>
				<a id="media-<?php 
    echo $_this->get_field_id('title_img');
    ?>
" <?php 
    echo $title_img ? $display_none : '';
    ?>
><?php 
    _e('Click here to select image', 'happykids');
    ?>
</a>
				<a id="remov-<?php 
    echo $_this->get_field_id('title_img');
    ?>
" <?php 
    echo !$title_img ? $display_none : '';
    ?>
><?php 
    _e('Remove this image', 'happykids');
    ?>
</a>
				<input class="image" style="visibility:hidden;" readonly id="<?php 
    echo $_this->get_field_id('title_img');
    ?>
" name="<?php 
    echo $_this->get_field_name('title_img');
    ?>
" type="text" value="<?php 
    echo esc_attr($title_img);
    ?>
" />
				<img id="img-<?php 
    echo $_this->get_field_id('title_img');
    ?>
" src<?php 
    echo $thumb_url;
    ?>
 alt />
				</p>
			</div>
		</div>
		<div>
			<a class="reset_icon_options"><?php 
    _e("Reset icon options", 'happykids');
    ?>
</a>
		</div>
	</section>
	<?php 
    ob_end_flush();
}