<?php

/* Types */

function get_typeByID( $id ) {
	global $dbConnection;
	$id = (int)$id;
	$stmt = $dbConnection->executeQuery('SELECT id, name, description FROM strip_t WHERE id = ?', array($id));
	$r = $stmt->fetch();
	$r->meta = $dbConnection->fetchAll('SELECT meta AS id FROM meta WHERE type = ?',  array($id));
	return $r;
}

function get_allTypes() {
	global $dbConnection;
	$stmt = $dbConnection->executeQuery('SELECT id, name, description, meta FROM strip_t');
	return $stmt->fetch();
}

function get_allMetaTypes() {
	global $dbConnection;
	return $dbConnection->fetchAll('SELECT id, name FROM meta_t');
}

function _getMetaNameFromObject($obj) {
	return $obj->name;
}

?>
