}
            ?>
                            
                    <?php 
        }
        ?>
                    <li><?php 
        wp_loginout(home_url());
        ?>
</li>
            <?php 
    } else {
        ?>
                    <li class="visible-xs-block"><a id="login" href="#">Entrar</a></li>
                    <?php 
        if (registration_is_open()) {
            ?>
                        <li><a href="<?php 
            bloginfo('url');
            ?>
/inscricoes">Inscreva-se</a></li>
                    <?php 
        }
        ?>
            <?php 
    }
    ?>
            
        </ul>

         <div class="login-form-menu">
Ejemplo n.º 2
0
function show_page()
{
    global $javascript;
    $javascript = <<<HEREDOC
      function processKey(e, id) {
        if (null == e)
          e = window.event;
        if (e.keyCode == 13)  {
          document.getElementById(id).click();
          return false;
        }
      }
HEREDOC;
    lmt_page_header('Status');
    if (registration_is_open()) {
        $reg_status = 'Open';
        $reg_action = 'lmt_close_reg';
        $reg_action_name = 'Close';
    } else {
        $reg_status = 'Closed';
        $reg_action = 'lmt_open_reg';
        $reg_action_name = 'Open';
    }
    if (backstage_is_open()) {
        $backstage_status = 'Open';
        $backstage_action = 'lmt_close_backstage';
        $backstage_action_name = 'Close';
    } else {
        $backstage_status = 'Closed';
        $backstage_action = 'lmt_open_backstage';
        $backstage_action_name = 'Open';
    }
    if (scoring_is_enabled()) {
        $scoring_status = 'Enabled';
        $scoring_action = 'lmt_freeze_scoring';
        $scoring_action_name = 'Freeze';
    } else {
        $scoring_status = 'Frozen';
        $scoring_action = 'lmt_enable_scoring';
        $scoring_action_name = 'Enable';
    }
    $lmt_year = htmlentities(map_value('year'));
    $lmt_date = htmlentities(map_value('date'));
    $individual_cost = htmlentities(map_value('indiv_cost'));
    $team_cost = htmlentities(map_value('team_cost'));
    $backstage_message = htmlentities(map_value('backstage_message'));
    $reg_close = htmlentities(map_value('reg_close'));
    $num_coaches = DB::queryFirstField('SELECT COUNT(*) AS c FROM schools WHERE deleted="0"');
    $num_teams = DB::queryFirstField('SELECT COUNT(*) AS c FROM teams WHERE deleted="0"');
    $num_individuals = DB::queryFirstField('SELECT COUNT(*) AS c FROM individuals WHERE email <> "" AND deleted="0"');
    echo <<<HEREDOC
      <h1>Status</h1>
      
      <h2>Settings</h2>
      <div class="indented">
        <form method="post" action="{$_SERVER['REQUEST_URI']}">
        <div><input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" /></div>
          <table style='vertical-align:middle;'>
            <tr>
              <td>Registration:</td>
              <td><span class="b">{$reg_status}</span></td>
              <td><input type="submit" name="{$reg_action}" value="{$reg_action_name}" /></td>
            </tr><tr>
              <td>Backstage:</td>
              <td><span class="b">{$backstage_status}</span> <span class="small">to regular members</span></td>
              <td><input type="submit" name="{$backstage_action}" value="{$backstage_action_name}" /></td>
            </tr><tr>
              <td>Score Entry:</td>
              <td><span class="b">{$scoring_status}</span></td>
              <td><input type="submit" name="{$scoring_action}" value="{$scoring_action_name}" /></td>
            </tr><tr>
              <td>Date:</td>
              <td><input type="text" name="date" value="{$lmt_date}" size="25" onkeydown="return processKey(event, 'lmtChangeDate');" />&nbsp;</td>
              <td><input id="lmtChangeDate" type="submit" name="lmt_update_date" value="Update" /></td>
            </tr><tr>
              <td>Year:</td>
\t\t\t  <td><input type="text" name="year" value="{$lmt_year}" size="4" maxlength="4" onkeydown="return processKey(event, 'lmtChangeYear');" /></td>
              <td><input id="lmtChangeYear" type="submit" name="lmt_update_year" value="Update" /><div style='color:red;font-size:0.6em;'>Use <a href='Post_LMT'>Post_LMT</a> directly after the LMT event ends.</div></td>
            </tr><tr>
              <td>Individual Cost:</td>
              <td><input type="text" name="indiv_cost" value="{$individual_cost}" size="25" onkeydown="return processKey(event, 'lmtChangeIndiv');" /></td>
              <td><input id="lmtChangeIndiv" type="submit" name="lmt_update_indiv_cost" value="Update" /></td>
            </tr><tr>
              <td>Team Cost:</td>
              <td><input type="text" name="team_cost" value="{$team_cost}" size="25" onkeydown="return processKey(event, 'lmtChangeTeam');" /></td>
              <td><input id="lmtChangeTeam" type="submit" name="lmt_update_team_cost" value="Update" /></td>
            </tr><tr>
              <td>Backstage Message:&nbsp;</td>
              <td><textarea name="backstage_message" rows="5" cols="20">{$backstage_message}</textarea></td>
              <td><input id="lmtBackstageMessage" type="submit" name="lmt_update_backstage_message" value="Update" /></td>
            </tr><tr>
              <td>Registration Closing Date:</td>
              <td><input type="text" name="reg_close" value="{$reg_close}" size="25" onkeydown="return processKey(event, 'lmtRegClose');" /></td>
              <td><input id="lmtRegClose" type="submit" name="lmt_update_reg_close" value="Update" /></td>
            </tr>
          </table>
        </form>
      </div>
      
      <br />
      <h2>Statistics</h2>
      <div class="indented">
        <span class="b">{$num_coaches}</span> coaches have registered a total of <span class="b">{$num_teams}</span> teams.<br />
        <span class="b">{$num_individuals}</span> unaffiliated individuals have signed up.
      </div>
HEREDOC;
    die;
}
/** cancel subscription by user id */
function cancel_subscription()
{
    $pid = sprintf("%d", $_POST['pid']);
    if (empty($pid)) {
        return false;
    }
    // se as inscricoes estiverem encerradas apenas administradores podem cancelar
    if (!current_user_can('administrator') && !registration_is_open()) {
        return false;
    }
    if (current_user_can('administrator') || current_user_is_the_author($pid)) {
        if (delete_post_meta($pid, 'subscription_number')) {
            delete_post_meta($pid, 'subscription-valid');
            print 'true';
            die;
        }
    }
    print 'false';
    die;
}
    function widget($args, $instance)
    {
        extract($args);
        print $before_widget;
        if (is_user_logged_in()) {
            global $user_ID;
            $user_meta = array_map(function ($a) {
                return $a[0];
            }, get_user_meta($user_ID));
            printf('<h3 class="widget__title">' . __('Olá, %s!', 'historias') . '</h3>', user_short_name());
        } else {
            if (!empty($instance['title'])) {
                // print $before_head;
                print $before_title . $instance['title'] . $after_title;
                // print $after_head;
            }
        }
        echo '<div class="widget-body">';
        if (is_user_logged_in()) {
            global $user_login;
            ?>

                <ul id="menu-user" class="menu--user menu">


                    <?php 
            if (current_user_can('level_10')) {
                //admin
                ?>
                       
                        <li><i class="fa fa-cog"></i> <a href="<?php 
                bloginfo('url');
                ?>
/wp-admin/">Painel</a></li>
                        <li><i class="fa fa-pencil-square-o"></i> <a href="<?php 
                bloginfo('url');
                ?>
/inscricoes">Inscrições</a></li>
                        <li><i class="fa fa-check-square-o"></i> <a href="<?php 
                bloginfo('url');
                ?>
/avaliacoes">Avaliações</a></li>
                    
                    <?php 
            } elseif (current_user_can('curate')) {
                //curador ou avaliador
                ?>
                        
                        <li><i class="fa fa-pencil-square-o"></i> <a href="<?php 
                bloginfo('url');
                ?>
/avaliacoes">Avaliações</a></li>
                    
                    <?php 
            } elseif (current_user_can('publish_posts')) {
                //editor do site
                ?>
                        
                        <li><i class="fa fa-pencil-square-o"></i> <a href="<?php 
                bloginfo('url');
                ?>
/inscricoes">Minha Ficha</a></li>
                        <li><i class="fa fa-cog"></i> <a href="<?php 
                bloginfo('url');
                ?>
/wp-admin/">Painel</a></li>
                    
                    <?php 
            } elseif (current_user_can('read')) {
                //eleitor
                ?>
                        <li><i class="fa fa-comments"></i> <a href="<?php 
                echo get_link_forum_user();
                ?>
">Meu fórum</a></li>
                      
                        <?php 
                if (get_user_meta($user_ID, 'e_candidato', true)) {
                    ?>
 
                            <li><i class="fa fa-pencil-square-o"></i> <a href="<?php 
                    bloginfo('url');
                    ?>
/inscricoes">Minha ficha de inscrição</a></li>
                        <?php 
                } else {
                    ?>
                            <?php 
                    if (registration_is_open()) {
                        ?>
                                <li><i class="fa fa-pencil-square-o"></i> <a href="<?php 
                        bloginfo('url');
                        ?>
/inscricoes">Quero me candidatar!</a></li>
                            <?php 
                    }
                    ?>
                        <?php 
                }
                ?>
                    <?php 
            }
            ?>
                    <li><i class="fa fa-user"></i> <a href="<?php 
            bloginfo('url');
            ?>
/wp-admin/profile.php">Meu perfil</a></li>
                    <li><i class="fa fa-sign-out"></i> <?php 
            wp_loginout(get_permalink());
            ?>
</li>
                </ul>

            <?php 
        } else {
            ?>
            	
                <div class="login-form">
                <?php 
            wp_login_form(array('label_username' => __('E-mail '), 'label_password' => 'Senha', 'label_log_in' => 'Entrar', 'remember' => false));
            ?>
                <a href="<?php 
            echo wp_lostpassword_url(get_permalink());
            ?>
" id="lost-password"><?php 
            _e('Esqueci a senha', 'historias');
            ?>
</a>
                 <?php 
            if (registration_is_open()) {
                ?>
                    <a href="<?php 
                bloginfo('url');
                ?>
/inscricoes" id="registrar" class="button"><?php 
                _e('Inscrever-me', 'historias');
                ?>
</a>
                <?php 
            }
            ?>
                </div>
            <?php 
        }
        echo '</div>';
        echo $after_widget;
    }
Ejemplo n.º 5
0
function lmt_reg_restrict_access($level)
{
    // Registration must be open
    if (!registration_is_open()) {
        lmt_location('');
    }
    // Check permissions
    if ($level == 'X' && isset($_SESSION['LMT_user_id'])) {
        lmt_location('Registration');
    }
    if ($level == 'L' && !isset($_SESSION['LMT_user_id'])) {
        lmt_location('Registration');
    }
}
	    <?php 
    }
    ?>
	<?php 
}
?>
</section>


<?php 
get_footer();
?>

<?php 
if (current_user_can('curate')) {
    if (current_user_can('administrator')) {
        $form_disabled = true;
        $disabled = ' disabled';
        if (!$reviewer) {
            die;
        }
        include get_template_directory() . '/inscricoes/inscricoes-avaliacao.php';
    } else {
        $form_disabled = registration_is_open();
        if ($form_disabled == true) {
            $disabled = ' disabled';
        }
        $reviewer = $current_user->ID;
        include get_template_directory() . '/inscricoes/inscricoes-avaliacao.php';
    }
}