public function getClass($param, $exportReq)
 {
     # need at least 1 param for this store procedure
     if (isset($param[0])) {
         # always force exec_proc when csv requested
         if ($exportReq) {
             $a = $this->conn->exec_proc('get_students_for_survey', $param, $exportReq);
             return $a;
         }
         # build manifest
         $attr = splice::getEndpointAttr($_SESSION['j']['endpoints'], $this);
         $respStarter = splice::respManifest($attr['id'], $attr['name'], $attr['version'], $attr['options']);
         # cache state | exec_proc
         $a = phpFastCache::get('student_survey' . $param[0]);
         if ($a == null) {
             $a = $this->conn->exec_proc('get_students_for_survey', $param, $exportReq);
             phpFastCache::set('student_survey' . $param[0], json_decode($a));
         } else {
             $a = json_encode($a, JSON_PRETTY_PRINT);
         }
         ##
         $res = str_replace('%__dataset__%', $a, $respStarter);
         return $res;
     } else {
         throw new \Exception('-- missing params --');
     }
 }
 public function getPosseStudent($param, $exportReq)
 {
     # always force exec_proc when csv requested
     if ($exportReq) {
         $a = $this->conn->exec_proc('get_posse_students', $param, $exportReq);
         return $a;
     }
     # build manifest
     $attr = splice::getEndpointAttr($_SESSION['j']['endpoints'], $this);
     $respStarter = splice::respManifest($attr['id'], $attr['name'], $attr['version'], $attr['options']);
     ##
     # cache state | exec_proc
     $a = phpFastCache::get('posse');
     if ($a == null) {
         $a = $this->conn->exec_proc('get_posse_students', $param, $exportReq);
         phpFastCache::set('posse', json_decode($a));
     } else {
         $a = json_encode($a, JSON_PRETTY_PRINT);
     }
     ##
     $res = str_replace('%__dataset__%', $a, $respStarter);
     return $res;
 }
Esempio n. 3
0
#			call_user_func_array(array($person, 'displayName'), array($name));
#		});
#
# __hack__
#	- Slim.php : v2.6.1 : line# 1293 : comment Slim error handler in favor of custom error handler \\Log()
# Composer PSR-4 autoload
require dirname(__FILE__) . '/api/vendor/autoload.php';
use Vassar\Ais\Util\ResponseHelper as sigValidate;
use Vassar\Ais\Util\Consumer as consumer;
use Vassar\Ais\Util\Log as log;
use Vassar\Ais\Util\Cacher as phpFastCache;
use Slim\Middleware\HttpBasicAuthentication\ArrayAuthenticator;
# Error/Exception Handling
log::init();
# caching lib
phpFastCache::init();
# define constants
require_once __DIR__ . '/lib/Vassar/Ais/Db/db-cred.inc.php';
# user authorization schema
$auth_schema = file_get_contents(__DIR__ . '/auth/clients.json');
$u = json_decode($auth_schema, true);
# valid service endpoints
$contents = file_get_contents(__DIR__ . '/api/endpoints.json');
$_SESSION['j'] = json_decode($contents, true);
# init consumer/client
if (isset($_SERVER['PHP_AUTH_USER'])) {
    consumer::init($_SERVER['PHP_AUTH_USER'], $u);
} elseif (isset($_GET['client-id'])) {
    consumer::init($_GET['client-id'], $u);
}
#