Commit de5e6891 authored by Marc-Antoine Dupré's avatar Marc-Antoine Dupré
Browse files

Reformat cofinancement detail.php

- Remove some commented code,
- redo indentation,
- with no change to the code logic.
parent 3a1697cb
<?php
$camp=Crowdfunding::getCampaignAndCounters((string)$element["_id"]);
// var_dump($element);
// var_dump($camp);
// 'goal' =>
// 'idCamp' =>
// 'nameCamp' =>
// 'pledgeNumber'
// 'donationNumber'
$currency_symbol = "€";
$rest = $camp["goal"] - $camp["donationNumber"] - $camp["pledgeNumber"];
$rest_txt = (string)$rest . $currency_symbol;
$donations_txt = (string)$camp["donationNumber"] . $currency_symbol;
$pledges_txt = (string)$camp["pledgeNumber"] . $currency_symbol;
$requested_text = (string)$camp["goal"] . $currency_symbol;
$donations_perc = round($camp["donationNumber"] / $camp["goal"] * 100);
$pledges_perc = "";
if ($rest <= 0) {
$pledges_perc = 100 - $donations_perc;
} else {
$pledges_perc = round($camp["pledgeNumber"] / $camp["goal"] * 100);
}
$donations_perc_txt = (string)$donations_perc;
$pledges_perc_txt = (string)$pledges_perc;
// $eltId="";;
$eltId=key($element['parent']);
$eltType= $element['parent'][$eltId]['type'];
$eltName= $element['parent'][$eltId]['name'];
$currency_symbol = "€";
$rest = $camp["goal"] - $camp["donationNumber"] - $camp["pledgeNumber"];
$rest_txt = (string)$rest . $currency_symbol;
$donations_txt = (string)$camp["donationNumber"] . $currency_symbol;
$pledges_txt = (string)$camp["pledgeNumber"] . $currency_symbol;
$requested_text = (string)$camp["goal"] . $currency_symbol;
$donations_perc = round($camp["donationNumber"] / $camp["goal"] * 100);
$pledges_perc = "";
if ($rest <= 0) {
$pledges_perc = 100 - $donations_perc;
} else {
$pledges_perc = round($camp["pledgeNumber"] / $camp["goal"] * 100);
}
$donations_perc_txt = (string)$donations_perc;
$pledges_perc_txt = (string)$pledges_perc;
$eltId=key($element['parent']);
$eltType= $element['parent'][$eltId]['type'];
$eltName= $element['parent'][$eltId]['name'];
?>
<div class="campaign">
<h1><?php echo $element["name"]?><br>
<small><?php echo $camp["nameCamp"]?></small>
<span style="font-size:50%;text-transform: none;">Porté par <a href="#page.type.<?php echo $eltType ?>.id.<?php echo $eltId ?>" class="lbh" target="_blank"><?php echo $eltName ?></a></span>
</h1>
<div>
<img class="img-responsive col-xs-12 col-sm-6 col-md-4" src="<?php echo $element["profilMediumImageUrl"]?>">
<div class="description col-xs-12 col-sm-6 col-md-8">
<h2>Description de l'action</h2>
<p>#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#</p>
<div class="fin-progress">
<div>
<strong>Dons : <?php echo $donations_txt ?></strong>
<strong>Reste à financer : <?php echo $rest_txt ?> / <?php echo $requested_text ?></strong>
</div>
<div class="progress">
<div class="progress-bar donations" role="progressbar" style="width: <?php echo $donations_perc_txt ?>%" aria-valuenow="<?php echo $donations_perc_txt ?>" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar pledges" role="progressbar" style="width: <?php echo $pledges_perc_txt?>%" aria-valuenow="<?php echo$pledges_perc_txt ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div>
<strong>Promesses : <?php echo $pledges_txt ?></strong>
</div>
</div>
<div class="text-center">
<a href="javascript:;" class="btn btn-lg btn-primary addDonation" data-id="<?php echo $element['_id'] ?>" data-name="<?php echo $element['name'] ?>" data-type="<?php echo $element['collection'] ?>" data-id-camp="<?php echo $camp['idCamp'] ?>" data-name-camp="<?php echo $camp['nameCamp']?>">Je cofinance cette campagne !</a>
</div>
</div>
</div>
<h1><?php echo $element["name"]?><br>
<small><?php echo $camp["nameCamp"]?></small>
<span style="font-size:50%;text-transform: none;">Porté par
<a href="#page.type.<?php echo $eltType ?>.id.<?php echo $eltId ?>"
class="lbh" target="_blank"><?php echo $eltName ?></a>
</span>
</h1>
<div>
<img class="img-responsive col-xs-12 col-sm-6 col-md-4" src="<?php echo $element["profilMediumImageUrl"]?>">
<div class="description col-xs-12 col-sm-6 col-md-8">
<h2>Description de l'action</h2>
<p>#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#</p>
<div class="fin-progress">
<div>
<strong>Dons : <?php echo $donations_txt ?></strong>
<strong>Reste à financer : <?php echo $rest_txt ?> / <?php echo $requested_text ?></strong>
</div>
<div class="progress">
<div class="progress-bar donations" role="progressbar"
style="width: <?php echo $donations_perc_txt ?>%"
aria-valuenow="<?php echo $donations_perc_txt ?>"
aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar pledges" role="progressbar"
style="width: <?php echo $pledges_perc_txt?>%"
aria-valuenow="<?php echo$pledges_perc_txt ?>"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div>
<strong>Promesses : <?php echo $pledges_txt ?></strong>
</div>
</div>
<div class="text-center">
<a href="javascript:;" class="btn btn-lg btn-primary addDonation"
data-id="<?php echo $element['_id'] ?>"
data-name="<?php echo $element['name'] ?>"
data-type="<?php echo $element['collection'] ?>"
data-id-camp="<?php echo $camp['idCamp'] ?>"
data-name-camp="<?php echo $camp['nameCamp']?>">Je cofinance cette campagne !</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
// function renderCampaignDetail(campaign) {
// let currency_symbol = "€";
// let rest = campaign.campaign_amount - campaign.donation_amount - campaign.pledge_amount;
// let rest_txt = rest.toString() + currency_symbol;
// let donations_txt = campaign.donation_amount.toString() + currency_symbol;
// let pledges_txt = campaign.pledge_amount.toString() + currency_symbol;
// let requested_text = campaign.campaign_amount.toString() + currency_symbol;
// let donations_perc = Math.round(campaign.donation_amount / campaign.campaign_amount * 100);
// let pledges_perc = "";
// if (rest <= 0) {
// pledges_perc = 100 - donations_perc;
// } else {
// pledges_perc = Math.round(campaign.pledge_amount / campaign.campaign_amount * 100);
// }
// let donations_perc_txt = donations_perc.toString();
// let pledges_perc_txt = pledges_perc.toString();
// let str = `
// <h1>#nom-de-l'organisation#<br>
// <small>#nom-de-la-campagne#</small>
// </h1>
// <div>
// <img src="${campaign.image_url}">
// <section class="description">
// <h2>Description de l'action</h2>
// <p>#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
// #description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
// #description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
// #description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#</p>
// <div class="fin-progress">
// <div>
// <strong>Dons : ${donations_txt}</strong>
// <strong>Reste à financer : ${rest_txt} / ${requested_text}</strong>
// </div>
// <div class="progress">
// <div class="progress-bar donations" role="progressbar" style="width: ${donations_perc_txt}%" aria-valuenow="${donations_perc_txt}" aria-valuemin="0" aria-valuemax="100"></div>
// <div class="progress-bar pledges" role="progressbar" style="width: ${pledges_perc_txt}%" aria-valuenow="${pledges_perc_txt}" aria-valuemin="0" aria-valuemax="100"></div>
// </div>
// <div>
// <strong>Promesses : ${pledges_txt}</strong>
// </div>
// </div>
// <div class="text-center">
// <a href="javascript:;" class="btn btn-lg btn-primary editPledge">Je cofinance cette campagne !</a>
// </div>
// </section>
// </div>
// `;
// return str;
// }
// function displayCampaign(element) {
// let img_url = notEmpty(contextData.profilMediumImageUrl) ? contextData.profilMediumImageUrl : contextData.defaultImg;
// // TODO: fetch real values from the campaign's associated pledges.
// let sum = parseInt(contextData.campaignSum);
// let campaign = {
// donation_amount: Math.round(sum/4.7),
// pledge_amount: Math.round(sum/2.9),
// campaign_amount: sum,
// image_url: img_url
// };
// element.innerHTML = renderCampaignDetail(campaign);
// }
jQuery(document).ready(function() {
pageProfil.bindViewActionEvent();
// $(".editPledge").click(function(){
// dyFObj.editMode=true;
// //uploadObj.set(type, id);
// uploadObj.update = true;
// dyFObj.currentElement={type : contextData.type, id : contextData.id};
// dataEdit=jQuery.extend(true, {},contextData);
// if(typeof contextData.typeOrga != "undefined")
// dataEdit.type=contextData.typeOrga;
// dyFObj.openForm('pledge', null, dataEdit);
// });
// displayCampaign($(".campaign")[0]);
});
jQuery(document).ready(function() {
pageProfil.bindViewActionEvent();
// $(".editPledge").click(function(){
// dyFObj.editMode=true;
// //uploadObj.set(type, id);
// uploadObj.update = true;
// dyFObj.currentElement={type : contextData.type, id : contextData.id};
// dataEdit=jQuery.extend(true, {},contextData);
// if(typeof contextData.typeOrga != "undefined")
// dataEdit.type=contextData.typeOrga;
// dyFObj.openForm('pledge', null, dataEdit);
// });
// displayCampaign($(".campaign")[0]);
});
</script>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment