'; //echo ""; $myurl='http://asteckles.x10.mx/fivestarlanguage/report.php?'; echo '
'; switch ($_GET['page']) { case 'classes': $sql="select count(stars) as star_count, users.description as user_description, users.user as user_name, classes.name as class_name, classes.id as class_id, AVG(`stars`) as class_stars from `users` inner join stars on users.id=stars.user inner join `classes` on stars.class=classes.id where stars.user=".$_GET['user_id']." group by classes.id"; $result=mysql_query($sql,$con); $_SESSION["userurl"]=$_SERVER['QUERY_STRING']; $sql2='select count(modules.name) as module_count, classes.name as class_name from modules inner join classes on modules.class=classes.id group by classes.name'; $result2=mysql_query($sql2,$con); $numfields2 = mysql_num_fields($result2); while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)){ $row_array[$row['class_name']] = $row['module_count'] * 9; } echo "

" . $_GET['user_name'] . "

"; echo ""; echo ""; while ($row = mysql_fetch_array($result)) { $desc=$row['user_description']; echo""; } break; case 'modules': $sql='select count(modules.name) as module_count, classes.description as classes_description, modules.description as module_description, modules.name as module_name, modules.id as module_id, AVG(`stars`) as module_stars from `modules` inner join classes on modules.class=classes.id inner join `stars` on modules.id=stars.module where stars.user='.$_GET["user_id"].' and stars.class='.$_GET["class_id"].' group by modules.id'; $_SESSION["classurl"]=$_SERVER['QUERY_STRING']; $result=mysql_query($sql,$con); echo "

> " . $_GET['user_name'] . " > ".$_GET['class_name']."

"; echo "
CLASSESSCORE (%)PROGRESS (%)
".$row['class_name']."" . round(20*$row['class_stars']) . "".round((($row['star_count']/$row_array[$row['class_name']])*100))."
"; echo ""; while ($row = mysql_fetch_array($result)) { $desc=$row['classes_description']; echo""; } break; case 'tasks': $sql='select modules.description as module_description, tasks.name as task_name, tasks.id as task_id, AVG(`stars`) as task_stars from `tasks` inner join modules on tasks.module=modules.id inner join `stars` on tasks.id=stars.task where stars.user='.$_GET["user_id"].' and stars.module='.$_GET["module_id"].' and stars.class='.$_GET["class_id"].' group by tasks.id'; $result=mysql_query($sql,$con); $_SESSION["taskurl"]=$_SERVER['QUERY_STRING']; echo "

> " . $_GET['user_name'] . " > ".$_GET['class_name']." > " . $_GET['module_name'] . "

"; echo "
MODULESSCORE (%)
".$row['module_name']."" . round(20*$row['module_stars']) . "
"; echo ""; $desc=$_GET['module_description']; while ($row = mysql_fetch_array($result)) { //$desc=$row['module_description']; //echo""; echo""; } break; default: $sql="select count(stars) as star_count, clients.client as client_name, AVG(`stars`) as all_stars, users.description as user_description, users.user as user_name, users.id as user_id from `users` inner join clients on users.client=clients.id inner join `stars` on stars.user=users.id where clients.client='" .$_GET['client_name']. "' group by users.user"; // $sql2="select count(modules.name) as module_count, clients.client as client_name from modules inner join classes on modules.class=classes.id inner join clients on classes.client=clients.id where classes.client=0"; // $sql3="select avg(stars.stars) as average_stars, clients.client as client_name from stars inner join classes on stars.class=classes.id inner join clients on classes.client=clients.id where classes.client=0"; $sql2="select count(modules.name) as module_count, clients.client as client_name from modules inner join classes on modules.class=classes.id inner join clients on classes.client=clients.id"; $sql3="select avg(stars.stars) as average_stars, clients.client as client_name from stars inner join classes on stars.class=classes.id inner join clients on classes.client=clients.id"; $result=mysql_query($sql,$con); $result2=mysql_query($sql2,$con); $result3=mysql_query($sql3,$con); $numfields2 = mysql_num_fields($result2); while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)){ $row_array[$row['client_name']] = $row['module_count'] * 9; } $numfields2 = mysql_num_fields($result3); while ($row = mysql_fetch_array($result3, MYSQL_ASSOC)){ // $row_array[$row['client_name'] . '_average'] = round(20*$row['average_stars']); $class_average=round(20*$row['average_stars']); } // echo "

" . $_SERVER['QUERY_STRING'] . "

"; echo ''; echo "
EXCERCISESSCORE (%)
".$row['task_name']."" . round(20*$row['task_stars']). "
".$row['task_name']."" . round(20*$row['task_stars']). "
"; echo ""; while ($row = mysql_fetch_array($result)) { echo""; } } echo "
SCORE (%) PROGRESS (%)
" . round(20*$row['all_stars']) . " ".$row_array[$row['client_name'] . '_average']."".round((($row['star_count']/$row_array[$row['client_name']])*100))."

".$desc."

"; //echo "Average
"; mysql_close($con);