diff --git a/classes/constellation.php b/classes/constellation.php
index b8b7b16..f7ab8d0 100644
--- a/classes/constellation.php
+++ b/classes/constellation.php
@@ -72,7 +72,8 @@ class Constellation
public function render_status($admin = false, $heading = true){
global $mysqli;
- $query = $mysqli->query("SELECT id, name FROM services");
+ //$query = $mysqli->query("SELECT id, name, description FROM services");
+ $query = $mysqli->query("SELECT services.id, services.name, services.description, services_groups.name as group_name FROM services LEFT JOIN services_groups ON services.group_id=services_groups.id ORDER BY services_groups.name ");
$array = array();
if ($query->num_rows){
$timestamp = time();
@@ -87,10 +88,10 @@ class Constellation
$tmp = $sql->get_result();
if ($tmp->num_rows)
{
- $array[] = new Service($result['id'], $result['name'], $tmp->fetch_assoc()['type']);
+ $array[] = new Service($result['id'], $result['name'], $result['description'], $result['group_name'], $tmp->fetch_assoc()['type']);
}
else{
- $array[] = new Service($result['id'], $result['name']);
+ $array[] = new Service($result['id'], $result['name'], $result['description'], $result['group_name']);
}
}
if ($heading)
@@ -103,11 +104,27 @@ class Constellation
}
if (!$admin)
{
- echo '
';
+ ?>
+
+ ';
+ //$arrCompletedGroups = array();
foreach($array as $service){
+ //print_r($service);
+ //if ( !empty($service->group_name) && !in_array($service->group_name, $arrCompletedGroups)) {
+//print $service->name;
+ // $arrCompletedGroups[] = $service['group_name'];
+ // $service->render(true);
+ //} else {
$service->render();
+ //}
}
- echo '
';
+ echo '';
+ //echo '';
}
else{
return $array;
diff --git a/classes/service.php b/classes/service.php
index d86383b..268715c 100644
--- a/classes/service.php
+++ b/classes/service.php
@@ -6,19 +6,24 @@ class Service implements JsonSerializable
{
private $id;
private $name;
+ private $description;
+ private $group_name;
private $status;
/**
* Constructs service from its data.
* @param int $id service ID
* @param String $name service name
+ * @param String $descriotion service description for tooltip
* @param int $status current service status
*/
- function __construct($id, $name, $status=3)
+ function __construct($id, $name, $description=null, $group_name='', $status=3)
{
//TODO: Maybe get data from ID?
$this->id = $id;
$this->name = $name;
+ $this->description = $description;
+ $this->group_name = $group_name;
$this->status = $status;
}
@@ -49,6 +54,15 @@ class Service implements JsonSerializable
return $this->name;
}
+ /**
+ * Returns description of this service
+ * @return String description
+ */
+ public function get_description()
+ {
+ return $this->description;
+ }
+
/**
* Processes submitted form and adds service unless problem is encountered,
* calling this is possible only for admin or higher rank. Also checks requirements
@@ -192,17 +206,56 @@ class Service implements JsonSerializable
/**
* Renders this service.
+ * @param $boolGroup set to true if the groups name is to be rendered
* @return void
*/
public function render(){
global $statuses;
global $classes;
- ?>
-
-
name; ?>
- status!=-1){?>
status]);?>
-
- group_name) || !in_array($this->group_name, $arrCompletedGroups) ) {
+ echo '';
+ $boolOpened = false;
+ }
+ }
+
+ // If no group exist or group is new, start a new UL
+ if ( !empty($this->group_name) && !in_array($this->group_name, $arrCompletedGroups)) {
+ echo '