| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- /**
- * Custom filter entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * A custom_Filter.
- *
- * Represents an object from the table 'filter'.
- *
- * @category Entity
- */
- class Custom_Filter extends Entity{
- /**
- * @var int Player identifier.
- */
- public $uid;
- /**
- * @var int Filter identifier.
- */
- public $id;
- /**
- * @var string Name of the pge the filter is for.
- */
- public $page;
- /**
- * @var string Filter name.
- */
- public $name;
- /**
- * @var string Filter description.
- */
- public $description;
- /**
- * @var string Filter condition (sql where clause).
- */
- public $condition;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * run, populating it and it's items.
- *
- * @param int $id Filter identifier.
- * @global resource Database connection.
- */
- public function __construct($id){
- global $db;
- $s = "
- SELECT
- uid,
- id,
- page,
- name,
- description,
- condition
- FROM filter
- WHERE id = $id;
- ";
- $q = $db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- $this->id = $r["id"];
- $this->uid = $r["uid"];
- $this->page = $r["page"];
- $this->name = HTML::e($r["name"]);
- $this->description = $r["description"]; // Must be properly formated!
- $this->condition = $r["condition"];
- }
- }
- ?>
|