110 lines
4.4 KiB
PHP
110 lines
4.4 KiB
PHP
<?php
|
|
/*
|
|
Crowd Discusses Alternatives is a web application for more organized discussions that help people create alternative solutions, evaluate and rank them.
|
|
|
|
Copyright 2021-2022 Stavros Kalognomos
|
|
|
|
This file is part of Crowd Discusses Alternatives.
|
|
|
|
Crowd Discusses Alternatives is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
Crowd Discusses Alternatives is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License along with Crowd Discusses Alternatives. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
session_start(); //session_start(); on the top of the code.
|
|
require_once 'includes/autoloader-inc.php';
|
|
require "header.php";
|
|
?>
|
|
|
|
<main>
|
|
|
|
<?php
|
|
$cdaContrObj = new CdaContr();
|
|
$cdaContrObj->checkIfLoggedIn(null);
|
|
|
|
$cdaViewObj = new CdaView();
|
|
$tgpcrObj = new Tgpcr();
|
|
|
|
if (!(isset($_REQUEST['selectedProposals']))) {
|
|
exit("<br><br><b>-- Error: selected proposals array is not found!<b>");
|
|
}
|
|
|
|
$selectedProposals = explode(",", $_REQUEST['selectedProposals']);
|
|
$selectedProposalsAsString = $_REQUEST['selectedProposals'];
|
|
|
|
if (count($selectedProposals) < 2) {
|
|
exit("<br><br><b>-- Error: Less than two proposals are selected!<b>");
|
|
}
|
|
|
|
$firstSelectedProposal = $cdaViewObj->showSelectedTgpcr("p", (int)$selectedProposals[0]);
|
|
$topicId = $firstSelectedProposal["topic_id"];
|
|
$checkIfMember = $cdaContrObj->checkIfMemberInTopic((int)$topicId, (int)$_SESSION["userId"]);
|
|
if ($checkIfMember === 0) {
|
|
unset($cdaContrObj);
|
|
unset($cdaViewObj);
|
|
unset($tgpcrObj);
|
|
exit("<br><br><b>-- Error: Topic id not found!<b>");
|
|
} elseif ($checkIfMember === null) {
|
|
unset($cdaContrObj);
|
|
unset($cdaViewObj);
|
|
unset($tgpcrObj);
|
|
exit("<br><br><b>-- Note: You are not a member of this topic! " .
|
|
"You can contact with the initiator of this topic via a personal message.<b>");
|
|
}
|
|
|
|
$selectedCateg = 'n';
|
|
require_once "selectednavbar.php";
|
|
?>
|
|
|
|
<p id="tip_select">Please, select the most well-written proposal from these similar proposals, by clicking on its text (content). Consider also to vote the same for similar proposals!</p>
|
|
<br>
|
|
<label form="form_create">Report selected proposals as similar</label>
|
|
|
|
<p id="p_create_urlvar"></p>
|
|
|
|
<div class="tgpcrAll" id="div_selected_proposals">
|
|
<?php
|
|
require_once "headeroftable.php";
|
|
foreach ($selectedProposals as $proposalKey => $proposalValue) {
|
|
$category = 'p';
|
|
$tgpcr = $cdaViewObj->showSelectedTgpcr('p', (int)$proposalValue); //proposalValue: proposalId.
|
|
?><div id="for_proposal_A_id_p<?php echo $proposalValue ?>" onclick="selectProposalA(event)"><?php
|
|
require "viewtgpcr.php";
|
|
?></div><?php
|
|
if ($tgpcr['edit_state'] >= 1) {
|
|
?> </div> <?php
|
|
require "closehtmltag.php";
|
|
exit("<br><br><b>-- Note: You cannot report proposals that are in editing phase as similar!</b>");
|
|
}
|
|
}
|
|
?>
|
|
<label class="label_for" for="selectedProposalAid">Selected most well-written proposal from the above similar proposals:</label>
|
|
<div id="showSelectedProposalA">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<form action="includes/createnewsimilarity-inc.php" method="post" name="form_create" id="form_create">
|
|
<div id="selecteddata" style="display: none;">
|
|
<input type="text" id="selectedProposals" name="selectedProposals" value="<?php echo $selectedProposalsAsString; ?>">
|
|
<input type="text" id="selectedProposalAid" name="selectedProposalAid" value="0">
|
|
</div>
|
|
<button type="submit" name="create_submit">OK</button>
|
|
</form>
|
|
<br>
|
|
|
|
<script type="module" src="./createnewsimilarity.js"></script>
|
|
<script type="text/javascript" src="./viewtgpcr.js"></script>
|
|
<script type="text/javascript" src="./selectproposala.js"></script>
|
|
<?php
|
|
unset($cdaContrObj);
|
|
unset($cdaViewObj);
|
|
unset($tgpcrObj);
|
|
?>
|
|
|
|
</main>
|
|
|
|
<?php
|
|
require "footer.php";
|
|
?>
|