Ejemplo n.º 1
0
header('X-Content-Type-Options: nosniff');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
//PHP Native Session setting
if (!isset($_SESSION)) {
    session_cache_limiter(false);
    session_start();
}
/**
 * Initialize Cookie Security params
 */
$cookiesSettings = array('cookies.secret_key' => 'edupol', 'cookies.cipher' => MCRYPT_RIJNDAEL_256, 'cookies.cipher_mode' => MCRYPT_MODE_CBC);
$app = new Slim($cookiesSettings);
$app->contentType('application/json');
$rank = Rank::getInstance();
$division = Division::getInstance();
$address = Address::getInstance();
$position = Position::getInstance();
$examstore = ExamStore::getInstance();
$course = Course::getInstance();
$examAssignment = ExamAssignment::getInstance();
$app->get('/ranks', array($rank, 'getRanks'));
$app->get('/positions', array($position, 'getPositions'));
$app->get('/division/belongto', array($division, 'getBelongto'));
$app->get('/divisions', array($division, 'getDivisions'));
$app->post('/division/mapping', array($division, 'saveMapping'));
$app->get('/squads', array($address, 'getSquad'));
$app->get('/sections', array($address, 'getSection'));
$app->get('/provinces', array($address, 'getProvinces'));
$app->get('/provinces/:id', array($address, 'getProvincesByDivisionID'));