namespace Ventus\Student; //============================================================================================ // Session, config //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('student', true); if (!isset($SESSION->logged_in)) { header('location: index.php?next=' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']); die; } //============================================================================================ // Load the Model and L10N //============================================================================================ $model = new Transcription($dbo); $dashboard = new Dashboard($dbo); if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) { $l10n->setLanguage($SESSION->corr_lang); \Locale::setDefault($SESSION->corr_lang); } $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Load the page requested by the user //============================================================================================ $this_page = "transcription"; if (!isset($_GET['page'])) { $count_pending_follow_ups = $dashboard->fetchCountPendingFollowUps($SESSION->student_num); $incomplete_book_transcription_requests = $model->fetchIncompleteBookTranscriptionRequests($SESSION->student_num); $complete_book_transcription_requests = $model->fetchCompleteBookTranscriptionRequests($SESSION->student_num); $l10n->addResource(__DIR__ . '/l10n/header.json');
namespace Ventus\Transcription; //============================================================================================ // Session, configuration file, localization constructor //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('internal', true); if (!isset($SESSION->lang)) { $SESSION->lang = DEFAULT_LANGUAGE; } \Locale::setDefault($SESSION->lang); $l10n->setLanguage($SESSION->lang); //============================================================================================ // Model //============================================================================================ $transcriptions = new Transcription($dbo); $follow = new \Ventus\Specialist\FollowUps($dbo); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page']) || $_GET['page'] === "book-requests") { $render = true; $book_data = $transcriptions->getAllBookTranscriptionRequests(); $l10n->addResource(__DIR__ . '/l10n/book-requests.json'); $l10n->localizeArray($book_data, 'transcription_name'); $viewFile = 'views/book-requests.php'; } elseif ($_GET['page'] === "view-book-request") { $render = true; $book_data = $transcriptions->getBookTranscriptionInfo($_GET['id']); $log_data = $transcriptions->fetchTranscriptionLog($_GET['id']); $l10n->addResource(__DIR__ . '/l10n/book-details.json');
/** * API Method inserts a new Transcription record and render response as JSON */ public function Create() { try { $json = json_decode(RequestUtil::GetBody()); if (!$json) { throw new Exception('The request body does not contain valid JSON'); } $transcription = new Transcription($this->Phreezer); // TODO: any fields that should not be inserted by the user should be commented out // this is an auto-increment. uncomment if updating is allowed // $transcription->Idtranscription = $this->SafeGetVal($json, 'idtranscription'); $transcription->Iditem = $this->SafeGetVal($json, 'iditem'); $transcription->Idmedia = $this->SafeGetVal($json, 'idmedia'); $transcription->Transcription = $this->SafeGetVal($json, 'transcription'); $transcription->Notes = $this->SafeGetVal($json, 'notes'); $transcription->Language = $this->SafeGetVal($json, 'language'); $transcription->Validate(); $errors = $transcription->GetValidationErrors(); if (count($errors) > 0) { $this->RenderErrorJSON('Please check the form for errors', $errors); } else { $transcription->Save(); $this->RenderJSON($transcription, $this->JSONPCallback(), true, $this->SimpleObjectParams()); } } catch (Exception $ex) { $this->RenderExceptionJSON($ex); } }