예제 #1
0
function listerfav()
{
    global $wpdb;
    $precedent = $_SERVER['REQUEST_URI'];
    $user = get_current_user_id();
    if ($user == 0) {
        $_SESSION['context'] = $precedent;
        Redirect_('login');
        die;
    } else {
        $choisis = avoir_favoris();
        ?>
       <div id="primary">
       <?php 
        if ($choisis) {
            //   $my_query = new WP_Query(array( 'post__in' => $choisis));
            //var_dump ($my_query);
            $ids = join("','", $choisis);
            $sql = "SELECT ID, post_title, post_name FROM {$wpdb->posts}\n\t    WHERE ID IN ('{$ids}') AND post_type = 'projet'";
            $my_queries = $wpdb->get_results($sql);
            ?>
	
	    <div id="content" role="main">
	    <table style="width: 100%">
	    <th><h5>Titre</h5></th>
         <?php 
            //while ($my_query->have_posts()) :
            //$my_query->the_post();
            //var_dump($ids);
            foreach ($my_queries as $my_query) {
                ?>
	    
	    <tr>
	    <td>
	    <a href="<?php 
                get_permalink($my_query->ID);
                ?>
" rel="bookmark" title="Permanent Link to <?php 
                get_the_title($my_query->ID);
                ?>
">
	    <?php 
                if (get_the_title($my_query->ID)) {
                    $title = $my_query->post_title;
                    echo $title;
                } else {
                    _e('Sans titre');
                }
                ?>
	     </a>
	     </td>
	     <td align="center">
		<?php 
                contacter();
                ?>
	     </td>
	    </tr>	 
	    <?php 
            }
            // end of the loop.
            ?>
	    </table>
	     </div><!-- #content -->
	     <?php 
        } else {
            ?>
 <div>Vous n'avez pas de favoris actuellement</div> <?php 
        }
        ?>
	 <?php 
    }
    ?>
      
       <a href="javascript:history.back()">Retour</a>
</div><!-- #primary -->
<?php 
}
예제 #2
0
<?php

/*
 Template Name:liste
*/
session_start();
$precedent = $_SERVER['REQUEST_URI'];
$user = get_current_user_id();
if ($user == 0) {
    $_SESSION['context'] = $precedent;
    header('location:login');
} else {
    get_header();
    $choisis = avoir_favoris();
    if ($choisis) {
        $my_query = new WP_Query(array('post__in' => $choisis));
        ?>
	<div id="primary">
	    <div id="content" role="main">
	    <h3>Nos sujets Favoris</h3>
	    
	    <table style="width: 60%">
	    <th><h5>Titre</h5></th>
         <?php 
        while ($my_query->have_posts()) {
            $my_query->the_post();
            ?>
	    
	    <tr>
	    <td>
	    <a href="<?php 
예제 #3
0
function button_postuler()
{
    ?>
	<div>
	<?php 
    /*  $mongroupe=get_user_meta(get_current_user_id(),'mongroupe',true);
              $query = "SELECT post_id FROM `wp_postmeta` WHERE  meta_value like '$mongroupe'";
              $result = mysql_query($query);
    	 
    	  $i=0;
    	   while ($row = mysql_fetch_assoc($result)){
    		$definie[]=$row[post_id];
              }
    	print_r ($definie);
    	$definie=get_user_meta(get_current_user_id(), 'favoris', false);*/
    $definie = avoir_favoris();
    $mongroupe = get_user_meta(get_current_user_id(), 'mongroupe', true);
    ?>
        <?php 
    $postid = get_the_ID();
    ?>
	<div style="float: right;">
	<?php 
    //echo'  <a  target="_blank" href="mailto:'; the_author_email(); echo '"> ecrire a l\'encadrant </a>';
    ?>
	</div>
        <?php 
    if (!empty($definie) && $definie && in_array($postid, $definie)) {
        ?>
                 <small style="color: green; float:;">D&eacute;j&agrave; Choisi</small>
        <?php 
    } elseif (!empty($mongroupe) && $mongroupe) {
        ?>
	
            <form action="<?php 
        echo bloginfo('url');
        ?>
/postuler" method="post">
                <input type="hidden" value="<?php 
        the_ID();
        ?>
" name="postid"/>
                <input type="hidden" value="<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
" name="precedent"/>
                <input type="submit" value="postuler" style=" height: 19px"/>
            </form>  
        <?php 
    }
    ?>

	</div>
	
<?php 
}