/** * @covers Mods34SchemaSubmissionAdapter */ public function testMods34SchemaSubmissionAdapter() { // Test constructor. $adapter = new Mods34SchemaSubmissionAdapter(PersistableFilter::tempGroup('metadata::plugins.metadata.mods34.schema.Mods34Schema(CITATION)', 'class::lib.pkp.classes.submission.Submission')); self::assertEquals(ASSOC_TYPE_CITATION, $adapter->getAssocType()); self::assertType('Mods34Schema', $adapter->getMetadataSchema()); self::assertEquals('Submission', $adapter->getDataObjectClass()); // Instantiate a test description. $submissionDescription =& $this->getMods34Description(); // Instantiate test submission. $submission = new Submission(); $submission->setTitle('previous submission title', 'en_US'); $submission->setAbstract('previous abstract', 'en_US'); // Remove the abstract to test whether the injection into existing data works. // (The abstract should not be deleted.) $submissionDescription->removeStatement('abstract'); // Test metadata injection (no replace). $resultSubmission =& $adapter->injectMetadataIntoDataObject($submissionDescription, $submission, 'lib.pkp.tests.plugins.metadata.mods34.filter.Author'); $expectedResult = array('cleanTitle' => array('en_US' => 'new submission title', 'de_DE' => 'neuer Titel'), 'title' => array('en_US' => 'new submission title', 'de_DE' => 'neuer Titel'), 'abstract' => array('en_US' => 'previous abstract'), 'sponsor' => array('en_US' => 'Some Sponsor'), 'dateSubmitted' => '2010-07-07', 'language' => 'en', 'pages' => 215, 'coverageGeo' => array('en_US' => 'some geography'), 'mods34:titleInfo/nonSort' => array('en_US' => 'the', 'de_DE' => 'ein'), 'mods34:titleInfo/subTitle' => array('en_US' => 'subtitle', 'de_DE' => 'Subtitel'), 'mods34:titleInfo/partNumber' => array('en_US' => 'part I', 'de_DE' => 'Teil I'), 'mods34:titleInfo/partName' => array('en_US' => 'introduction', 'de_DE' => 'Einführung'), 'mods34:note' => array('en_US' => array('0' => 'some note', '1' => 'another note'), 'de_DE' => array('0' => 'übersetzte Anmerkung')), 'mods34:subject/temporal[@encoding="w3cdtf" @point="start"]' => '1950', 'mods34:subject/temporal[@encoding="w3cdtf" @point="end"]' => '1954'); self::assertEquals($expectedResult, $resultSubmission->getAllData()); // Test meta-data extraction. $adapter = new Mods34SchemaSubmissionAdapter(PersistableFilter::tempGroup('class::lib.pkp.classes.submission.Submission', 'metadata::plugins.metadata.mods34.schema.Mods34Schema(CITATION)')); $extractedDescription =& $adapter->extractMetadataFromDataObject($submission); $submissionDescription->removeStatement('recordInfo/recordCreationDate[@encoding="w3cdtf"]'); self::assertTrue($submissionDescription->addStatement('recordInfo/recordCreationDate[@encoding="w3cdtf"]', date('Y-m-d'))); self::assertTrue($submissionDescription->addStatement('abstract', $abstract = 'previous abstract')); $missingMappings = array('genre[@authority="marcgt"]', 'originInfo/place/placeTerm[@type="text"]', 'originInfo/place/placeTerm[@type="code" @authority="iso3166"]', 'originInfo/publisher', 'originInfo/dateIssued[@keyDate="yes" @encoding="w3cdtf"]', 'originInfo/edition', 'physicalDescription/form[@authority="marcform"]', 'physicalDescription/internetMediaType', 'identifier[@type="isbn"]', 'identifier[@type="doi"]', 'identifier[@type="uri"]', 'location/url[@usage="primary display"]', 'recordInfo/recordIdentifier[@source="pkp"]', 'subject/topic'); foreach ($missingMappings as $missingMapping) { $submissionDescription->removeStatement($missingMapping); } self::assertEquals($submissionDescription, $extractedDescription); }
public static function updateSubmission() { // Process updating submissions $submissions = SubmissionsDB::getSubmissionsBy('submissionId', $_SESSION['arguments']); if (empty($submissions)) { HomeView::show(); header('Location: /' . $_SESSION['base']); } elseif ($_SERVER["REQUEST_METHOD"] == "GET") { $_SESSION['submissions'] = $submissions; SubmissionView::showUpdate(); } else { $parms = $submissions[0]->getParameters(); $parms['submissionFile'] = array_key_exists('submissionFile', $_POST) ? $_POST['submissionFile'] : ""; $newSubmission = new Submission($parms); $newSubmission->setSubmissionId($submissions[0]->getSubmissionId()); $submission = SubmissionsDB::updateSubmission($newSubmission); if ($submission->getErrorCount() != 0) { $_SESSION['submissions'] = array($newSubmission); SubmissionView::showUpdate(); } else { HomeView::show(); header('Location: /' . $_SESSION['base']); } } }
public function testExecute_PlainSystemCommand() { $submission = new Submission(); $submission->setWorkDir('/home/guilherme/Documentos/PHP_Projeto/'); $gcccompiler = new GccCompiler(); $runner = new Runner(); $judge = new Judge($gcccompiler, $runner); $judge->judge('/home/guilherme/Documentos/PHP_Projeto/', $submission, 'Prime'); }
/** * @response - array * * Inserts the user submissions into the database */ public static function create_submission($response) { $submission = new Submission(); foreach ($response as $key => $val) { $submission->{$key} = $val; } if ($submission->save()) { return true; } return false; }
public static function getSubmissionsArray($rowSets) { // Return an array of Submission objects extracted from $rowSets $submissions = array(); foreach ($rowSets as $submissionRow) { $submission = new Submission($submissionRow); $submission->setSubmissionId($submissionRow['submissionId']); array_push($submissions, $submission); } return $submissions; }
public function testUpdateSubmission() { ob_start(); $validSubmission = array("submitterName" => "krobbins", "assignmentNumber" => "1", "submissionFile" => "myText.apl"); $s1 = new Submission($validSubmission); $s1->setSubmissionId(1); $_SESSION = array('submission' => $s1, 'base' => "mvcdbcrud"); SubmissionView::showUpdate(); $output = ob_get_clean(); $this->assertFalse(empty($output), "It should show an update form"); }
function checkoutWithPaypal($total, $cart) { try { $paypal = new PayPal(true); } catch (Exception $e) { Logger::i()->writeLog("Caught Exception: " . $e->getMessage(), 'dev'); die; } $params = array('RETURNURL' => createURLForScript("process.php"), 'CANCELURL' => createURLForScript("cancel.php"), 'PAYMENTREQUEST_0_AMT' => floatval(number_format(floatval($total), 2)), 'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR'); $params['SOLUTIONTYPE'] = "Sole"; $params['LANDINGPAGE'] = "Billing"; $k = 0; foreach ($cart as $key => $value) { $info = (array) $value; $params['L_PAYMENTREQUEST_0_NAME' . $k] = $info["name"]; $params['L_PAYMENTREQUEST_0_DESCR' . $k] = $info["description"]; $params['L_PAYMENTREQUEST_0_AMT' . $k] = floatval(number_format(floatval($info['price']), 2)); $params['L_PAYMENTREQUEST_0_QTY' . $k] = intval($info['quantity']); $k++; } $response = $paypal->doRequest("SetExpressCheckout", $params); if ($response) { Logger::i()->writeLog("Starting PayPal checkout"); return $paypal->generateURL($response['TOKEN']); } else { Logger::i()->writeLog("Could not get token, error = " . $paypal->error, 'dev'); die(Submission::createResult("Can not checkout at the moment. Please try again later.")); } }
/** * Check for roles that give access to the passed workflow stage. * @param int $userId * @param int $contextId * @param Submission $submission * @param int $stageId * @return array */ function _getAccessibleStageRoles($userId, $contextId, &$submission, $stageId) { $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /* @var $stageAssignmentDao StageAssignmentDAO */ $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES); $accessibleStageRoles = array(); foreach ($userRoles as $roleId) { switch ($roleId) { case ROLE_ID_MANAGER: // Context managers have access to all submission stages. $accessibleStageRoles[] = $roleId; break; case ROLE_ID_ASSISTANT: case ROLE_ID_SUB_EDITOR: case ROLE_ID_AUTHOR: // The requested workflow stage has been assigned to them // in the requested submission. $stageAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), $roleId, $stageId, $userId); if (!$stageAssignments->wasEmpty()) { $accessibleStageRoles[] = $roleId; } break; default: break; } } return $accessibleStageRoles; }
/** * Add an author. * @param $author Author */ function addAuthor($author) { if ($author->getSubmissionId() == null) { $author->setSubmissionId($this->getId()); } parent::addAuthor($author); }
/** * List signoff notes. * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function listNotes($args, $request) { $this->setupTemplate($request); $templateMgr = TemplateManager::getManager($request); $noteDao = DAORegistry::getDAO('NoteDAO'); $notesFactory = $noteDao->getByAssoc(ASSOC_TYPE_SIGNOFF, $this->_signoff->getId()); $notes = $notesFactory->toAssociativeArray(); // Get any note files. $noteFilesDownloadLink = array(); $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); /** @var $submissionFileDao SubmissionFileDAO */ import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction'); foreach ($notes as $noteId => $note) { $file = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_NOTE, $noteId, $this->_submission->getId(), SUBMISSION_FILE_NOTE); // We don't expect more than one file per note $file = current($file); // Get the download file link action. if ($file) { $noteFilesDownloadLink[$noteId] = new DownloadFileLinkAction($request, $file, $this->_stageId); } } $user = $request->getUser(); import('lib.pkp.classes.core.ArrayItemIterator'); $templateMgr->assign('notes', new ArrayItemIterator($notes)); $templateMgr->assign('noteFilesDownloadLink', $noteFilesDownloadLink); $templateMgr->assign('notesListId', 'notesList'); $templateMgr->assign('currentUserId', $user->getId()); $templateMgr->assign('notesDeletable', false); $json = new JSONMessage(true, $templateMgr->fetch('controllers/informationCenter/notesList.tpl')); $json->setEvent('dataChanged'); return $json->getString(); }
/** * Add an author. * @param $author Author */ function addAuthor($author) { if ($author->getPaperId() == null) { $author->setPaperId($this->getId()); } parent::addAuthor($author); }
/** * @copydoc GridCellProvider::getCellActions() */ function getCellActions($request, $row, $column) { switch ($column->getId()) { case 'contents': $element = $row->getData(); $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); import('lib.pkp.classes.submission.SubmissionFile'); $submissionFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_NOTE, $element->getId(), $this->_submission->getId(), SUBMISSION_FILE_QUERY); import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction'); $actions = array(); foreach ($submissionFiles as $submissionFile) { $actions[] = new DownloadFileLinkAction($request, $submissionFile, $request->getUserVar('stageId')); } return $actions; } return parent::getCellActions($request, $row, $column); }
public function testUpdateSubmission() { $myDb = DBMaker::create('ptest'); Database::clearDB(); $db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini'); $beforeCount = count(SubmissionsDB::getSubmissionsBy()); $submissions = SubmissionsDB::getSubmissionsBy('submissionId', 1); $currentSubmission = $submissions[0]; $parms = $currentSubmission->getParameters(); $parms['submissionFile'] = 'newFile.txt'; $newSubmission = new Submission($parms); $newSubmission->setSubmissionId($currentSubmission->getSubmissionId()); $updatedSubmission = SubmissionsDB::updateSubmission($newSubmission); $afterCount = count(SubmissionsDB::getSubmissionsBy()); $this->assertEquals($beforeCount, $afterCount, 'The number of submission in the database should not change after update'); $this->assertEquals($updatedSubmission->getSubmissionId(), $newSubmission->getSubmissionId(), 'The id of the updated submission should remain the same'); }
function deleteCustomer($c) { $delete = DbManager::i()->delete("sf_members", array("userid" => intval($c))); if (!$delete) { Logger::i()->writeLog("Deleting customer {$c} failed, error = " . DbManager::i()->error, 'dev'); return Submission::createResult("Could not delete customer"); } return Submission::createResult("Customer deleted", true); }
public function testIdNumbering() { /* try to see if the dirs are being created */ $this->assertEquals(get_file_name("data/uploads/0/020"), Submission::getPathToCodeFromId(20)); $this->assertEquals(get_file_name("data/uploads/1/000"), Submission::getPathToCodeFromId(1000)); $this->assertEquals(get_file_name("data/uploads/1/999"), Submission::getPathToCodeFromId(1999)); $this->assertEquals(get_file_name("data/uploads/178/456"), Submission::getPathToCodeFromId(178456)); assert(is_dir(get_file_name("data/uploads/1"))); assert(is_dir(get_file_name("data/uploads/178"))); }
/** * @copydoc GridCellProvider::getCellActions() */ function getCellActions($request, $row, $column) { switch ($column->getId()) { case 'label': $element = $row->getData(); if ($element->getRemoteUrl() != '' || !$element->getFileId()) { break; } $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); import('lib.pkp.classes.submission.SubmissionFile'); $submissionFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_REPRESENTATION, $element->getId(), $this->_submission->getId(), SUBMISSION_FILE_PROOF); import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction'); $actions = array(); foreach ($submissionFiles as $submissionFile) { $actions[] = new DownloadFileLinkAction($request, $submissionFile, $request->getUserVar('stageId'), $element->getLabel()); } return $actions; } return parent::getCellActions($request, $row, $column); }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $new_post = $_POST; if (isset($_FILES["submissionFile"])) { $new_post["submissionFile"] = $_FILES["submissionFile"]; } $submission = new Submission($new_post); if ($submission->getErrorCount() != 0) { SubmissionView::show($submission); } else { $user = UsersDB::getUserBy('userName', $submission->getUserName()); if ($user != null) { HomeView::show($user); } else { $submission->setError('userName', 'USER_NAME_DOES_NOT_EXIST'); SubmissionView::show($submission); } } } else { // Initial link SubmissionView::show(null); } }
function judge_a_single_submission() { // Clear all caches, otherwise we would use old data! Entity::clear_cache(); // Retrieve a submission global $self; $subm = Submission::get_pending_submission($self->name . micro_nonce()); if (!$subm) { // no submissions right now sleep(DAEMON_SLEEP_TIME); return; } // Some information on this submission if (VERBOSE) { echo "\n"; echo "Submission id: ", $subm->submissionid, "\n"; echo "Submission to: ", $subm->entity_path, "\n"; echo "Submited on: ", format_date($subm->time), "\n"; echo "Submission by: ", User::names_text($subm->users()), "\n"; // this slows things down } // Let's judge it try { $judgement = new SubmissionJudgement($subm); $judgement->judge(); } catch (Exception $e) { Log::error($e, $subm->entity_path, $self->name); echo "Error during judging!\n", $e; } if (VERBOSE) { echo "Result: ", Status::to_text($subm), "\n"; } // free up some memory unset($judgement); unset($subm); if (function_exists('gc_collect_cycles')) { // this doesn't exist in PHP < 5.3.0 :( gc_collect_cycles(); } if (VERBOSE) { echo "Memory usage: ", memory_get_usage(), "\n"; } }
public function get($functionName, $linkName, $params = array(), $checkSession = true) { $positive = function ($input) { //$input = $input[count($input)-1]; $result = Model::isEmpty(); $result['content'] = array(); foreach ($input as $inp) { if ($inp->getNumRows() > 0) { // extract Submission data from db answer $res = Submission::ExtractSubmission($inp->getResponse(), false); $result['content'] = array_merge($result['content'], is_array($res) ? $res : array($res)); $result['status'] = 200; } } return $result; }; $params = DBJson::mysql_real_escape_string($params); return $this->_component->call($linkName, $params, '', 200, $positive, array(), 'Model::isProblem', array(), 'Query'); }
function __construct() { Authentication::require_admin(); $this->is_admin_page = true; // find submission if (!isset($_REQUEST['submissionid'])) { throw new NotFoundException("Missing parameter: submissionid"); } $this->subm = Submission::by_id(intval($_REQUEST['submissionid'])); $this->entity = $this->subm->entity(); // rejudge? if (isset($_REQUEST['rejudge'])) { $this->subm->rejudge(); // redirect to this page, so a refresh doesn't rejudge again Util::redirect('admin_view_submission.php?submissionid=' . $_REQUEST['submissionid']); } // delete? if (isset($_REQUEST['delete'], $_POST['confirm']) && $_POST['confirm'] == sha1('confirmed' . $this->subm->submissionid)) { $this->subm->delete(); Util::redirect('index.php' . $this->entity->path()); } }
/** * This function is responsible for displaying the results page. * * It first sends data to the model for insertion into database. * If inserted correctly, displays the results page. */ public function get_results() { if (!($id = Route::input('id'))) { Log::error('Unable to display results. Route ID not found.'); return Redirect::to('error'); } if (!($answers = Session::get('answers'))) { Log::error('Unable to display results. Unable to retreive answers from session.'); return Redirect::to('error'); } if (!($restart = route('home'))) { Log::error('Unable to assign the restart button to a route.'); return Redirect::to('error'); } $responses = self::clean_results($answers); $submission = self::prepare_submission($id, $answers); if (Submission::create_submission($submission)) { return View::make('results', array('heading' => 'Thank you! Your outcome is provided below', 'outcome' => self::$outcomes[$id], 'responses' => $responses, 'restart' => $restart)); } Log::error('Unable to create submission. Database insertion failed'); return Redirect::to('error'); }
/** * Constructor. */ function Article() { parent::Submission(); $this->articleTexts = array(); $this->removedArticleTexts = array(); $this->articleSecIds = array(); $this->removedArticleSecIds = array(); $this->articlePurposes = array(); $this->removedArticlePurposes = array(); $this->articleOutcomes = array(); $this->removedArticleOutcomes = array(); $this->articleDrugs = array(); $this->removedArticleDrugs = array(); $this->articleSites = array(); $this->removedArticleSites = array(); $this->articleFundingSources = array(); $this->removedArticleFundingSources = array(); $this->articleSecondarySponsors = array(); $this->removedArticleSecondarySponsors = array(); $this->articleCROs = array(); $this->removedArticleCROs = array(); }
/** * Check for roles that give access to the passed workflow stage. * @param int $userId * @param int $contextId * @param Submission $submission * @param int $stageId * @return array */ function _getAccessibleStageRoles($userId, $contextId, &$submission, $stageId) { $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /* @var $stageAssignmentDao StageAssignmentDAO */ $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES); $accessibleStageRoles = array(); foreach ($userRoles as $roleId) { switch ($roleId) { case ROLE_ID_MANAGER: // Context managers have access to all submission stages. $accessibleStageRoles[] = $roleId; break; case ROLE_ID_ASSISTANT: case ROLE_ID_SUB_EDITOR: case ROLE_ID_AUTHOR: // The requested workflow stage has been assigned to them // in the requested submission. $stageAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), $roleId, $stageId, $userId); if (!$stageAssignments->wasEmpty()) { $accessibleStageRoles[] = $roleId; } if ($roleId == ROLE_ID_SUB_EDITOR) { // The requested submission must be part of their section/series... // and the requested workflow stage must be assigned to // them in the context settings. import('lib.pkp.classes.security.authorization.internal.SectionAssignmentRule'); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); if (SectionAssignmentRule::effect($contextId, $submission->getSectionId(), $userId) && $userGroupDao->userAssignmentExists($contextId, $userId, $stageId)) { $accessibleStageRoles[] = $roleId; } } break; default: break; } } return $accessibleStageRoles; }
if ($find !== false && !is_array($find)) { //cart already exists for user if ($find->cart != "e30=" && strlen($find->cart) != 4) { //not empty cart - overwrite with saved one from DB $_SESSION['shopping-cart'] = $find->cart; } else { //empty cart, use session cart if (isset($_SESSION['shopping-cart'])) { DbManager::i()->update("sf_carts", array("cart" => $_SESSION['shopping-cart']), array("userid" => intval($_SESSION['userid']))); } } } else { if (isset($_SESSION['shopping-cart'])) { DbManager::i()->insert("sf_carts", array("cart", "userid"), array($_SESSION['shopping-cart'], intval($_SESSION['userid']))); } } } else { Logger::i()->writeLog("Login is incorrect (" . $login['username'] . ":" . $login['password'] . ")"); echo Submission::createResult("Username or Password are incorrect"); } } else { Logger::i()->writeLog("User does not exist: " . $login['username']); echo Submission::createResult("No user found with this username"); } } else { Logger::i()->writeLog("Could not get check for login, error = " . DbManager::i()->error, 'dev'); echo Submission::createResult("Username or Password are incorrect"); } } else { echo Submission::createResult("Please fill in all information"); }
/** * Get an array representing link parameters that subclasses * need to have passed to their various handlers (i.e. submission ID * to the delete note handler). * @return array */ function _getLinkParams() { return array('submissionId' => $this->_submission->getId()); }
public function getSubmission() { if (isset($this->formState['values']['details']['sid'])) { return Submission::load($this->node->nid, $this->formState['values']['details']['sid']); } }
<?php if (!defined("IN_EXM")) { exit(1); } if ($login->isUserLoggedIn() === false) { exit(1); } // Get Submission id if (isset($_GET['sid']) && intval($_GET['sid']) > 0) { $sid = intval($_GET['sid']); } else { exit("Invalid submission!"); } $submission = new Submission($sid); foreach ($submission->getReview() as $key => $value) { // Get the last id in the array $id = $submission->getLatestReview($key); if ($id > -1) { // Get review $review = new Review($id); // If comment form was submitted add the comment $commentSubmitId = 'comment' . $review->id; if (key_exists($commentSubmitId, $_POST)) { $review->addComment($_POST[$commentSubmitId]); } echo '<div class="review_box">'; echo '<p>'; // Link to review if (get_class($review->data) == "TE") { echo '<a class="bold" href="?view=reviewthesis&sid=' . $submission->id . '&uid=' . $review->user . '">';
<?php include $_SERVER['DOCUMENT_ROOT'] . "/classes/access_user/ext_submission.php"; error_reporting(E_ALL); // I use this only for testing // $update_profile = new Users_profile(false); // need to be false otherwise the redirect to this page will not work // $update_profile->access_page($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']); // protect this page too. $view_submission = new Submission(false, false, VIEW_SUBMISSIONS); // protect this page too. if (isset($_POST['Submit'])) { if (1 < $view_submission->count) { $i = 0; $sel_count = 0; while ($i < $view_submission->count) { // Unckecked checkboxes are not posted // http://stackoverflow.com/questions/12115373/detect-unchecked-checkbox-php if (isset($_POST['selected' . $i])) { $sel_count++; } $i++; } if (10 < $sel_count) { // Too many selected submissions, warn the user and don't save changes. echo '<script type="text/javascript">'; echo 'window.alert("Please select no more than 10 findings for final evaluation!")'; echo '</script>'; } else { $i = 0; while ($i < $view_submission->count) { if (isset($_POST['selected' . $i])) { $view_submission->select_submission($i);
function last_submission_to($entity) { if (!$entity->submitable()) { return false; } if ($entity->attribute_bool('keep best')) { static $query; DB::prepare_query($query, "SELECT * FROM `user_submission` LEFT JOIN `submission` ON `user_submission`.`submissionid` = `submission`.`submissionid`" . " WHERE `userid`=? AND `entity_path`=?" . " ORDER BY `status` DESC, `time` DESC" . " LIMIT 1"); $query->execute(array($this->userid, $entity->path())); return Submission::fetch_one($query, '', false); } else { static $query; DB::prepare_query($query, "SELECT * FROM `user_submission` LEFT JOIN `submission` ON `user_submission`.`submissionid` = `submission`.`submissionid`" . " WHERE `userid`=? AND `entity_path`=?" . " ORDER BY `time` DESC" . " LIMIT 1"); $query->execute(array($this->userid, $entity->path())); return Submission::fetch_one($query, '', false); } }
/** * Constructor. */ function __construct() { parent::__construct(); }