コード例 #1
0
ファイル: destaques.php プロジェクト: hacklabr/cultural
    static function renderPage()
    {
        $homeObject = new stdClass();
        $homeObject->slug = self::FRONT_PAGE_SLUG;
        $homeObject->name = __('Página principal', 'cultural');
        $terms = array_merge(array($homeObject), get_terms('category'));
        // Crie o formulário. Abaixo você vai ver exemplos de campos de texto, textarea e checkbox. Crie quantos você quiser
        ?>
        <style>
            .highlights { border-bottom:1px solid #bbb; }
            .highlights section { float:left; margin:10px; width:450px; }
            .highlights textarea { width:100%; height:100px; }
        </style>
        <div class="wrap span-20">
            <h2><?php 
        _e('Destaques', 'cultural');
        ?>
</h2>

            <?php 
        if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true') {
            ?>
                <div id="message" class="updated below-h2">
                    <p>Configurações salvas.</p>
                    <div class="clear"></div>
                </div>
                <script type="text/javascript">
                    setTimeout(function () {
                        jQuery('#message').slideUp('fast');
                    }, 2000);
                </script>
            <?php 
        }
        ?>

            <form action="options.php" method="post" class="clear prepend-top">
                <p class="alignright">
                    <input type="submit" class="button-primary" value="<?php 
        _e('Salvar modificações', 'cultural');
        ?>
" />
                </p>
                <?php 
        settings_fields(self::OPTION_NAME);
        ?>
                <div class="span-20 ">
                    <p class="help">
                        <?php 
        _e("Cole na caixas abaixo as URLs dos posts que você deseja destacar para cada seção do site, uma URL por linha, na ordem que você deseja que apareça.<br>Deixe em branco se desejar que sejam destacados os últimos posts.", 'cultural');
        ?>
                    </p>
                    
                    <script>  
						jQuery(document).ready(function() {	
							jQuery.datetimepicker.setLocale('pt-BR');
							jQuery('.datetimepicker').datetimepicker({format: 'd/m/Y H:i'});
						});
					</script>
                    <?php 
        foreach ($terms as $term) {
            $name = function ($option_name) use($term) {
                echo Cultural_Hightlights::OPTION_NAME . "[{$term->slug}][{$option_name}]";
            };
            $option = Cultural_Hightlights::getOption($term->slug);
            ?>
                        <div class="highlights">
							
                            <h3><?php 
            echo $term->name;
            ?>
</h3>
                            <div style="margin:10px">
								
                                <strong><?php 
            _e('Posts destacados', 'cultural');
            ?>
</strong><br>
								<table class="table" style="width:100%">                               
									<thead>
										<th>URL do Post</th>
										<th>Data/Hora de Expiração</th>
									</thead>
									<tbody>
										
								<?php 
            for ($i = 0; $i < 5; $i++) {
                //Se o post estiver expirado, ele não é exibido e quando o usuário clicar em salvar, ele sumirá definitivamente
                ?>
									<tr>
										<td style="width:70%"><input style="padding:7px; width:100%" type="text" name="<?php 
                echo $name('highlights') . "[" . $i . "]";
                ?>
[url]" value="<?php 
                echo $option['highlights'][$i]['url'];
                ?>
" /></td>
										<td style="width:20%;margin:auto; text-align:center"><input class="datetimepicker" style="padding:7px; width:100%" type="text" name="<?php 
                echo $name('highlights') . "[" . $i . "]";
                ?>
[data_expiracao]" value="<?php 
                echo $option['highlights'][$i]['data_expiracao'];
                ?>
" /></td>
									</tr>
			                     <?php 
            }
            ?>
			                     </tbody>
			                     </table>

                               <!-- <textarea name="<?php 
            echo $name('highlights');
            ?>
"><?php 
            echo $option['highlights'];
            ?>
</textarea>-->
                            </div>

                           <!-- <section class="js-posts">
                                <strong><?php 
            _e('Posts fixos', 'cultural');
            ?>
</strong><br>
                                <textarea name="<?php 
            echo $name('fixed');
            ?>
"><?php 
            echo $option['fixed'];
            ?>
</textarea>
                            </section>-->
                            <div class="clear"></div>
                        </div>
                    <?php 
        }
        ?>
                </div>
                <p class="textright clear prepend-top">
                    <input type="submit" class="button-primary" value="<?php 
        _e('Salvar modificações', 'cultural');
        ?>
" />
                </p>
            </form>
        </div>

        <?php 
    }
コード例 #2
0
    static function renderPage()
    {
        $homeObject = new stdClass();
        $homeObject->slug = self::FRONT_PAGE_SLUG;
        $homeObject->name = __('Página principal', 'cultural');
        $terms = array_merge(array($homeObject), get_terms('category'));
        // Crie o formulário. Abaixo você vai ver exemplos de campos de texto, textarea e checkbox. Crie quantos você quiser
        ?>
        <style>
            .highlights { border-bottom:1px solid #bbb; }
            .highlights section { float:left; margin:10px; width:450px; }
            .highlights textarea { width:100%; height:100px; }
        </style>
        <div class="wrap span-20">
            <h2><?php 
        _e('Destaques', 'cultural');
        ?>
</h2>

            <?php 
        if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true') {
            ?>
                <div id="message" class="updated below-h2">
                    <p>Configurações salvas.</p>
                    <div class="clear"></div>
                </div>
                <script type="text/javascript">
                    setTimeout(function () {
                        jQuery('#message').slideUp('fast');
                    }, 2000);
                </script>
            <?php 
        }
        ?>

            <form action="options.php" method="post" class="clear prepend-top">
                <p class="alignright">
                    <input type="submit" class="button-primary" value="<?php 
        _e('Salvar modificações', 'cultural');
        ?>
" />
                </p>
                <?php 
        settings_fields(self::OPTION_NAME);
        ?>
                <div class="span-20 ">
                    <p class="help">
                        <?php 
        _e("Cole na caixas abaixo as URLs dos posts que você deseja destacar para cada seção do site, uma URL por linha, na ordem que você deseja que apareça.<br>Deixe em branco se desejar que sejam destacados os últimos posts.", 'cultural');
        ?>
                    </p>
                    <?php 
        foreach ($terms as $term) {
            $name = function ($option_name) use($term) {
                echo Cultural_Hightlights::OPTION_NAME . "[{$term->slug}][{$option_name}]";
            };
            $option = Cultural_Hightlights::getOption($term->slug);
            ?>
                        <div class="highlights">
                            <h3><?php 
            echo $term->name;
            ?>
</h3>
                            <section class="js-posts">
                                <strong><?php 
            _e('Posts destacados', 'cultural');
            ?>
</strong><br>
                                <textarea name="<?php 
            echo $name('highlights');
            ?>
"><?php 
            echo $option['highlights'];
            ?>
</textarea>
                            </section>

                            <section class="js-posts">
                                <strong><?php 
            _e('Posts fixos', 'cultural');
            ?>
</strong><br>
                                <textarea name="<?php 
            echo $name('fixed');
            ?>
"><?php 
            echo $option['fixed'];
            ?>
</textarea>
                            </section>
                            <div class="clear"></div>
                        </div>
                    <?php 
        }
        ?>
                </div>
                <p class="textright clear prepend-top">
                    <input type="submit" class="button-primary" value="<?php 
        _e('Salvar modificações', 'cultural');
        ?>
" />
                </p>
            </form>
        </div>

        <?php 
    }