/** * Gets the ModulePages associated with this Module. * @return \PhoenixSNS\Objects\ModulePage[] an array of ModulePages associated with this Module */ public function GetPages() { global $MySQL; $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "ModulePages WHERE modulepage_ModuleID = " . $this->ID; $retval = array(); $result = $MySQL->query($query); if ($result === false) { return $retval; } $count = $result->num_rows; if ($count == 0) { return $retval; } for ($i = 0; $i < $count; $i++) { $values = $result->fetch_assoc(); $retval[] = ModulePage::GetByAssoc($values); } return $retval; }
/** * Retrieves a single ModulePage with the given ID * @param int $id The ID of the ModulePage to return * @return NULL|\PhoenixSNS\Objects\ModulePage The ModulePage with the given ID, or NULL if no ModulePage with the requested ID was found. */ public static function GetByID($id) { if (!is_numeric($id)) { return null; } global $MySQL; $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "Modules WHERE module_ID = " . $id; $result = $MySQL->query($query); $count = $result->num_rows; if ($count == 0) { return null; } $values = $result->fetch_assoc(); return ModulePage::GetByAssoc($values); }