Commit 7c1b051d by Cyrille37

project post_status #65

parent 034bf81f
......@@ -9,6 +9,7 @@
namespace CommunityProject ;
require_once __DIR__. '/WPUtil.php';
require_once __DIR__. '/Settings.php';
require_once __DIR__. '/CommunityProject_install.php';
require_once __DIR__. '/UserRoleController.php';
......@@ -174,7 +175,9 @@ class CommunityProject
$author = $current_user->ID ;
}
else
{
$author = null ;
}
return get_posts( array(
'author' => $author,
......@@ -182,6 +185,7 @@ class CommunityProject
'numberposts' => 100,
'orderby' => 'date',
'order' => 'DESC',
'post_status' => 'any',
//'category' => 0,
//'include' => array(),
//'exclude' => array(),
......
......@@ -38,6 +38,8 @@ class DashboardWidget
*/
$projects = CommunityProject::get_projects();
$isStudent = UserRoleController::isStudent();
ob_start();
include __DIR__.'/templates/dashboard.php';
echo ob_get_clean();
......
<?php
namespace CommunityProject ;
class WPUtil
{
public static function statusToString( $status )
{
switch ( $status )
{
case 'draft': return __( 'Draft' );
case 'pending': return __( 'Pending Review' );
case 'private': return __( 'Private' );
case 'publish': return __( 'Published' );
}
return __( $status );
}
}
<?php
/**
* Available variables :
* - $isStudent : is the user has Student role
* - $projects : the array of WP_Post objects
WP_Post Object
......@@ -35,9 +36,18 @@
if( count($projects) == 0 )
{
if( $isStudent )
{
?>
<p>Vous n'avez aucun projet.</p>
<?php
}
else
{
?>
<p>Aucun projet.</p>
<?php
}
}
else
{
......@@ -50,6 +60,7 @@ else
?>
<li>
<span><?php echo get_post_time(get_option('time_format'), false, $project, true);?></span>
<i><?php echo \CommunityProject\WPUtil::statusToString( $project->post_status );?></i> -
<?php edit_post_link( $project->post_title, '', '', $project->ID, '' ); ?>
</li>
<?php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment