Exemplo n.º 1
0
<?php

require_once 'Connection.php';
require_once 'Entity.class.php';
$font = FONT;
getStatics();
/*Post header setup*/
$Eid = $_GET['id'];
$entity = Entity::reincarnate($Eid);
$ttab = "<div class='eList' >";
$ttab .= "<table>";
//delete
$size = UNIT;
$ttab .= "<tr><td colspan=7 align='right' ><form action='Delete.php' method='POST' onsubmit='return confirmReq()'>\n\t\t\t<button type='submit' name='eid' value='{$Eid}' style='background-color:inherit; border:0; cursor:pointer;' >\n\t\t\t\t<img src='img/delete.png' width='{$size}' height='{$size}' />\n\t\t\t</button>\n\t\t  </form></td></tr>\n\t\t  ";
//Type image
$ttab .= "<tr>";
$type = $entity->type;
$size = 3 * UNIT;
$ttab .= "<td rowspan=3 ><div class='edit' id='e-{$Eid}-type' > <img src='img/{$type}.png' width='{$size}' height='{$size}' /> </div></td>";
//Id
$ttab .= "<td align='center' style='font-size:{$font}' > {$entity->id} </td>";
//Title
$ttab .= "<td colspan=4 style='text-transform:uppercase; ' ><b><div class='edit' id='e-{$Eid}-title' > {$entity->title} </div></b></td>";
//Status
$status = $entity->status;
$size = UNIT;
$ttab .= "<td><div class='edit' id='e-{$Eid}-status' > <img src='img/{$status}.png' width='{$size}' height='{$size}' /> </div></td>";
$ttab .= "</tr>";
//Special,level,rating
$ttab .= "<tr>";
$ttab .= "<td>Special:</td> <td><div class='edit' id='e-{$Eid}-special' > {$entity->special} </div></td>";
Exemplo n.º 2
0
 public static function generateEntityList($query)
 {
     $ttab = "";
     $result = mysql_query($query) or die("Error in query: {$query}. " . mysql_error());
     if (mysql_num_rows($result) == 0) {
         return $ttab;
     }
     while ($row = mysql_fetch_assoc($result)) {
         $entityObjs[$row['id']] = Entity::reincarnate($row['id']);
     }
     //Header Table
     $ttab .= "<div class='eList'>";
     $ttab .= "<table>";
     $ttab .= "<tr>";
     //type
     $size = 3 * UNIT;
     $ttab .= "<td rowspan=2 width='{$size}' align='center' ><u><i> Type </i></u></td>";
     //id
     $size = 2 * UNIT;
     $ttab .= "<td width='{$size}' align='center' ><u><i> Id </i></u></td>";
     //title
     $ttab .= "<td align='center' ><u><i> Title </i></u></td>";
     //updated
     $size = 6 * UNIT;
     $ttab .= "<td width='{$size}' align='center' ><u><i> Updated </i></u></td>";
     //level
     $size = 2 * UNIT;
     $ttab .= "<td width='{$size}' align='center' ><u><i> Lvl </i></u></td>";
     //rating
     $ttab .= "<td width='{$size}' align='center' ><u><i> Rate </i></u></td>";
     //status
     $size = 3 * UNIT;
     $ttab .= "<td width='{$size}' align='center' ><u><i> Status </i></u></td>";
     $ttab .= "</tr>";
     $ttab .= "</table>";
     $ttab .= "</div>";
     //Content Table
     foreach ($entityObjs as $entity) {
         $class = $entity->special ? "special" : "eList";
         $ttab .= "<div class='{$class}' title='{$entity->description}' >";
         $ttab .= "<table>";
         $ttab .= "<tr >";
         //type
         $type = $entity->type;
         $size = 3 * UNIT;
         $ttab .= "<td rowspan=2 width='{$size}' > <img src='img/{$type}.png' width='{$size}' height='{$size}' /> </td>";
         //id
         $size = 2 * UNIT;
         $ttab .= "<td rowspan=2 width='{$size}' align='center' > {$entity->id} </td>";
         //title
         $ttab .= "<td style='text-transform:uppercase; ' > <a href='Post_Central.php?id={$entity->id}' ><b> {$entity->title} </b></a> </td>";
         //updated
         $size = 6 * UNIT;
         $up = getFmtdDate($entity->updated, 'jS M Y');
         $ttab .= "<td width='{$size}' align='center' > {$up} </td>";
         //level
         $size = 2 * UNIT;
         $ttab .= "<td width='{$size}' align='center' > {$entity->level} </td>";
         //rating
         $ttab .= "<td width='{$size}' align='center' > {$entity->rating} </td>";
         //status
         $status = $entity->status;
         $size = UNIT;
         $tdSize = 3 * UNIT;
         $ttab .= "<td width='{$tdSize}' align='center' > <img src='img/{$status}.png' width='{$size}' height='{$size}' /> </td>";
         $ttab .= "</tr>";
         $ttab .= "<tr>";
         //tags
         $ttab .= "<td colspan=7>";
         $tags = $entity->getTags();
         foreach ($tags as $tag) {
             $ttab .= "<div class='tag' ><a href='Search_Engine.php?tags={$tag}'> {$tag} </a></div>";
         }
         $ttab .= "</td>";
         $ttab .= "</tr>";
         $ttab .= "</table>";
         $ttab .= "</div>";
     }
     return $ttab;
 }
Exemplo n.º 3
0
<?php

require_once 'Connection.php';
require_once 'Entity.class.php';
if (isset($_POST['submit'])) {
    getStatics();
    $cid = $_POST['submit'];
    if ($cid == 0) {
        $entity = Entity::reincarnate($_POST['eid']);
        $com = $entity->addComment("", $_POST['comment'], $_POST['rating'], $_POST['special']);
        //File upload
        $cid = $com->id;
        $temp = explode(".", $_FILES["file"]["name"]);
        $extension = end($temp);
        if (!($_FILES["file"]["error"] > 0)) {
            $image = "store/img-{$cid}.{$extension}";
            move_uploaded_file($_FILES["file"]["tmp_name"], $image);
            $com->image = $image;
            $com->timeStamp = time();
            $entity->updated = $com->timeStamp;
            $com->persist();
            $entity->persist();
        }
        setStatics();
    } else {
        $entity = Entity::reincarnateByCid($cid);
        $com = $entity->commentObjs[$cid];
        //File upload
        $cid = $com->id;
        $temp = explode(".", $_FILES["file"]["name"]);
        $extension = end($temp);