Commit 3602f0d6 authored by Bate's avatar Bate

Planning2

parent 50c298ee
......@@ -76,13 +76,19 @@ class planningv extends stdcontents
* @param $titre Titre du contenu
* @param $db Connection à la base de donnée
*/
function planningv ( $titre, $db, $id_planning, $start, $end, $user_id=0, $force_single_column = false)
function planningv ( $titre, $db, $id_planning, $start, $end, $site, $force_single_column = false)
{
setlocale(LC_ALL, "fr_FR.UTF8");
$this->title=false;
$planning = new planning2($db, $db);
$planning->load_by_id($id_planning);
if(!$site->user->is_in_group_id($planning->group))
{
$this->buffer .= "<p>Droits insuffisants pour lire ce planning</p>";
return;
}
$gaps = $planning->get_gaps($start, $end);
......@@ -156,7 +162,7 @@ class planningv extends stdcontents
foreach( $my_gap as $gap_data)
{
$count++;
if($gap_data[0] == $user_id )
if($gap_data[0] == $site->user->id )
$buffer .= ($count==1?"":", ")."<a href=\"./planning2.php?action=remove_from_gap&user_gap_id=$gap_data[2]&id_planning=$planning->id\">".$gap_data[1]."</a>";
else
$buffer .= ($count==1?"":", ").$gap_data[1];
......
......@@ -8,6 +8,7 @@ class planning2 extends stdentity
var $admin_group;
var $start;
var $end;
var $is_public;
function load_by_id( $id )
{
......@@ -33,9 +34,10 @@ class planning2 extends stdentity
$this->weekly = $row['weekly_planning'];
$this->start = strtotime($row['start']);
$this->end = strtotime($row['end']);
$this->is_public = $row['is_public'];
}
function add ( $name, $group, $admin_group, $weekly, $start, $end )
function add ( $name, $group, $admin_group, $weekly, $start, $end, $is_public = true )
{
$this->name = $name;
$this->group = $group;
......@@ -43,6 +45,7 @@ class planning2 extends stdentity
$this->weekly = $weekly;
$this->start = $start;
$this->end = $end;
$this->is_public= $is_public;
$sql = new insert ($this->dbrw,
"pl2_planning",
......@@ -52,7 +55,8 @@ class planning2 extends stdentity
"id_admin_group" => $this->admin_group,
"start" => date("Y-m-d H:i:s",$this->start),
"end" => date("Y-m-d H:i:s",$this->end),
"weekly_planning" => $this->weekly
"weekly_planning" => $this->weekly,
"is_public" => $this->is_public
)
);
if ( !$sql->is_success() )
......@@ -66,13 +70,14 @@ class planning2 extends stdentity
return true;
}
function update ( $name, $group, $admin_group, $start, $end )
function update ( $name, $group, $admin_group, $start, $end , $is_public)
{
$this->name = $name;
$this->group = $group;
$this->admin_group = $admin_group;
$this->start = $start;
$this->end = $end;
$this->is_public = $is_public;
$sql = new update ($this->dbrw,
"pl2_planning",
......@@ -82,7 +87,8 @@ class planning2 extends stdentity
"id_admin_group" => $this->admin_group,
"start" => date("Y-m-d H:i:s",$this->start),
"end" => date("Y-m-d H:i:s",$this->end),
"weekly_planning" => $this->weekly
"weekly_planning" => $this->weekly,
"is_public" => $this->is_public
),
array("id_planning" => $this->id)
);
......
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