Example #1
0
        ?>
">
	    <?php 
        if (get_the_title()) {
            $title = the_title('', '', false);
            echo $title;
        } else {
            _e('Sans titre');
        }
        ?>
	     </a>
	     </td>
		<td>
		    <?php 
        $attribue = get_post_meta(get_the_ID(), affecte, true);
        $blogusers = lesmesbres($attribue);
        if (!empty($attribue) && isset($attribue)) {
            echo '<small>Attribu&eacute; &agrave; <strong>' . $attribue . '</strong></small></td><td>
			    <a href="mailto:';
            foreach ($blogusers as $user) {
                echo $user->user_email . ';';
            }
            ?>
		            ">contacter le groupe </a>
			    <?php 
        } else {
            $messujets[get_the_ID()] = $idsujet;
        }
        $idsujet++;
        ?>
		</td>
Example #2
0
function wpuf_user_dash_affecter_list($post_type)
{
    global $wpdb, $userdata;
    $userdata = get_userdata($userdata->ID);
    //affecter post
    if (!empty($_POST)) {
        $d = $_POST;
        if (empty($_POST['sujet']) || !isset($_POST['sujet']) || $_POST['sujet'] == "") {
            $error = "Veuillez choisir un projet";
        } elseif (empty($_POST['groupe']) || !isset($_POST['groupe'])) {
            $error = "Veuillez choisir un groupe";
        } else {
            $res = add_post_meta($d['sujet'], 'affecte', $d['groupe'], true);
            if ($res) {
                $favoris = groupe_favoris($d['groupe']);
                foreach ($favoris as $key => $value) {
                    delete_post_meta($value, 'favoris', $d['groupe']);
                }
                $error = "Le sujet  <strong>" . $d['sujet'] . "</strong> est affecté au <strong> " . $d['groupe'] . "</strong>  avec succès";
            } else {
                $error = "Erreur: Ce sujet deja affecté";
            }
        }
    }
    //get the posts count from db
    $sql = "SELECT count(ID) FROM {$wpdb->posts}\n            WHERE post_author = {$userdata->ID} AND post_type = '{$post_type}'\n            AND post_status = 'publish'";
    $total = $wpdb->get_var($sql);
    //setup the pagination variables
    $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 1;
    $limit = get_option('wpuf_list_post_range') ? get_option('wpuf_list_post_range') : 10;
    $offset = ($pagenum - 1) * $limit;
    $num_of_pages = $total > 0 ? ceil($total / $limit) : 0;
    $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('&laquo;', 'aag'), 'next_text' => __('&raquo;', 'aag'), 'total' => $num_of_pages, 'current' => $pagenum));
    //get the posts
    $sql = "SELECT ID, post_title, post_name, post_status, post_date FROM {$wpdb->posts}\n            WHERE post_author = {$userdata->ID} AND post_type = '{$post_type}'\n            AND post_status = 'publish' ORDER BY post_date DESC LIMIT {$offset}, {$limit}";
    $posts = $wpdb->get_results($sql);
    ?>

    <?php 
    echo '<div style="color:red;" >' . $error . '</div>';
    ?>

    <div style="float:left; width:65%;">
    
        
    <h2 class="page-head"><strong>
        <span class="colour"><?php 
    printf(__('Vos ' . $post_type . 's', 'wpuf'));
    ?>
</span>
        </strong>
    </h2>
    <?php 
    if ($posts) {
        ?>

        <?php 
        if (get_option('wpuf_list_post_count') == 'yes') {
            ?>
            <div class="post_count"><?php 
            _e('Vous avez ', 'wpuf');
            ?>
 <?php 
            echo "<span>{$total}</span> {$post_type}";
            ?>
(s)</div>
        <?php 
        }
        ?>
        
        <?php 
        do_action('wpuf_dashboard', $userdata->ID, $post_type);
        $idsujet = 0;
        ?>
          
             
        <table class="wpuf-table" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                     <th><?php 
        echo "N";
        ?>
</th>
                    <th><?php 
        _e('Titre', 'wpuf');
        ?>
</th>
                    <th><?php 
        _e('Etat', 'wpuf');
        ?>
</th>
                    <?php 
        if (get_option('wpuf_sub_charge_posting') == 'yes') {
            echo '<th>' . __('Payment', 'wpuf') . '</th>';
        }
        ?>
                    <th><?php 
        _e('Options', 'wpuf');
        ?>
</th>
                </tr>
            </thead>
            <tbody>
                <?php 
        wp_reset_query();
        ?>
                <?php 
        foreach ($posts as $p) {
            ?>
                    <tr>
                        <td>
                            <?php 
            echo ++$idsujet;
            ?>
                        </td>
                        <td>
                            <?php 
            if ($p->post_status == 'pending' || $p->post_status == 'draft' || $p->post_status == 'future') {
                ?>

                                <?php 
                echo wptexturize($p->post_title);
                ?>

                            <?php 
            } else {
                ?>

                                <a href="<?php 
                echo get_permalink($p->ID);
                ?>
"><?php 
                echo wptexturize($p->post_title);
                ?>
</a>

                            <?php 
            }
            ?>
                        </td>
                        <td>
                           
		    <?php 
            $attribue = get_post_meta($p->ID, affecte, true);
            $blogusers = lesmesbres($attribue);
            if (!empty($attribue) && isset($attribue)) {
                echo '<small>Attribu&eacute; &agrave; <strong>' . $attribue . '</strong></small></td><td>
			    <a href="mailto:';
                foreach ($blogusers as $user) {
                    echo $user->user_email . ';';
                }
                ?>
		            ">contacter le groupe </a>
			    <?php 
            } else {
                $messujets[$p->ID] = $idsujet;
            }
            ?>
                        </td>

                        <?php 
            if (get_option('wpuf_sub_charge_posting') == 'yes') {
                $order_id = get_post_meta($p->ID, 'wpuf_order_id', true);
                ?>
                            <td>
                                <?php 
                if ($p->post_status == 'pending' && $order_id) {
                    ?>
                                    <a href="<?php 
                    echo get_permalink(get_option('wpuf_sub_pay_page'));
                    ?>
?action=wpuf_pay&type=post&post_id=<?php 
                    echo $p->ID;
                    ?>
">Pay Now</a>
                                <?php 
                }
                ?>
                            </td>
                        <?php 
            }
            ?>
                    </tr>
                <?php 
        }
        ?>
            </tbody>
        </table>

        <div class="wpuf-pagination">
            <?php 
        if ($page_links) {
            echo $page_links;
        }
        ?>
        </div>

    <?php 
    } else {
        ?>

        <h3><?php 
        _e(utf8_encode('Actuellement vous n\'avez aucun ' . $post_type . ' publié'), 'wpuf');
        ?>
</h3>

    <?php 
    }
    ?>
 </div>
    
    <div style="float:right; width:34%">
	    <fieldset style="border:groove;padding-left:3%">
		<legend>Attribuer un Projet</legend>
		<form action=" <?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
" method="POST" ?>
		<p>
		<label for="sujet" >Quel projet ?</label> 
		<select id="sujet" name="sujet">;
		 <option value=""></option>
		<?php 
    if (!empty($messujets) && isset($messujets)) {
        foreach ($messujets as $key => $value) {
            ?>
			   <option value="<?php 
            echo $key;
            ?>
"><?php 
            echo $value;
            ?>
</option>
			  
		   <?php 
        }
    }
    ?>
		
		</select>
		</p>
		<p>
		    <label for="sujet" >A quel groupe ?</label> 
		    <select id="groupe" name="groupe">
			<option>-- Groupe--</option>
		    </select>
		</p>
		<input type="submit" value="attribuer" name="affecter"/>
		</form>
	    
            </fieldset> 
</div>

    
    <?php 
}