|
@@ -40,6 +40,16 @@ switch($_['action']){
|
|
$row = $sketch->toArray();
|
|
$row = $sketch->toArray();
|
|
$row['comment'] = truncate($row['comment'],65);
|
|
$row['comment'] = truncate($row['comment'],65);
|
|
$row['picture'] = $sketch->picture();
|
|
$row['picture'] = $sketch->picture();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $row['progress-color'] = 'bg-danger';
|
|
|
|
+ if($row['progress'] > 30) $row['progress-color'] = 'bg-warning';
|
|
|
|
+ if($row['progress'] > 45) $row['progress-color'] = 'bg-warning';
|
|
|
|
+ if($row['progress'] > 60) $row['progress-color'] = 'bg-info';
|
|
|
|
+ if($row['progress'] > 75) $row['progress-color'] = '';
|
|
|
|
+ if($row['progress'] > 90) $row['progress-color'] = 'bg-success';
|
|
|
|
+
|
|
|
|
+
|
|
$row['created'] = relative_time($row['created']);
|
|
$row['created'] = relative_time($row['created']);
|
|
$response['rows'][] = $row;
|
|
$response['rows'][] = $row;
|
|
}
|
|
}
|
|
@@ -61,6 +71,22 @@ switch($_['action']){
|
|
});
|
|
});
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ case 'hackpoint_sketch_progress_save':
|
|
|
|
+ Action::write(function(&$response){
|
|
|
|
+ global $myUser,$_;
|
|
|
|
+
|
|
|
|
+ require_once(__DIR__.SLASH.'Sketch.class.php');
|
|
|
|
+
|
|
|
|
+ Sketch::staticQuery('ALTER TABLE {{table}} ADD progress INTEGER;');
|
|
|
|
+
|
|
|
|
+ $item = Sketch::getById($_['id']);
|
|
|
|
+ if($myUser->login!=$item->creator) throw new Exception("Permissions insuffisantes",403);
|
|
|
|
+ $item->progress = $_['progress'];
|
|
|
|
+ $item->save();
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+
|
|
case 'hackpoint_sketch_add':
|
|
case 'hackpoint_sketch_add':
|
|
global $myUser,$_;
|
|
global $myUser,$_;
|
|
if(!$myUser->can('hackpoint','edit')) throw new Exception("Permissions insuffisantes",403);
|
|
if(!$myUser->can('hackpoint','edit')) throw new Exception("Permissions insuffisantes",403);
|