Commit f2ac02e7 authored by tonyemma's avatar tonyemma
Browse files
parents 2cfddb53 54745541
......@@ -508,10 +508,15 @@
}
.eventDirRaf a img{
height: 150px;
/*height: 150px; */
width: 100%;
}
.eventDirRaf .divImg {
height: 150px;
overflow: hidden;
}
.eventDirText{
position: relative;
height: 150px;
......@@ -532,4 +537,16 @@
#showHideCalendar{
font-size: 18px;
}
\ No newline at end of file
}
body #descriptionAbout, #descriptionAbout p, #descriptionAbout a, #descriptionAbout span, #descriptionAbout button{
font-size: 16px !important;
/*font-family: "customFont" !important;*/
}
#mainNav .logo-menutop{
margin-top: -8px !important;
}
.navbar-custom{
text-transform: none !important;
}
......@@ -564,7 +564,7 @@ function bindDynFormEditable(){
typeElement : contextData.type,
name : contextData.name,
shortDescription : $(".contentInformation #shortDescriptionAboutEdit").html(),
description : $("#descriptionMarkdown").html(),
description: dataHelper.htmlToMarkdown($(".contentInformation #descriptionAbout").html()),
};
dyFObj.openForm(form, "markdown", dataUpdate);
......
......@@ -18,14 +18,46 @@ pageProfil.views.detail = function(){
var url = "element/about/type/"+contextData.type+"/id/"+contextData.id;
ajaxPost('#central-container', baseUrl+'/'+moduleId+'/'+url+'?tpl=ficheInfoElement', null, function(){
if(contextData.type == "events"){
$("#parentAbout").parent().hide();
$("#typeAbout").parent().hide();
}
$("#parentAbout").parent().hide();
$("#divDiaspora").parent().hide();
$("#divMastodon").parent().hide();
$("#divGpplus").parent().hide();
$("#divGithub").parent().hide();
},"html");
}
pageProfil.views.directory = function(){
mylog.log("hva pageProfil.views.directory");
var dataIcon = (!notEmpty(pageProfil.params.dir)) ? "users" : $(".smma[data-type-dir="+pageProfil.params.dir+"]").data("icon");
pageProfil.params.dir=(!notEmpty(pageProfil.params.dir)) ? links.connectType[contextData.type] : pageProfil.params.dir;
var sub=(!notEmpty(pageProfil.params.sub)) ? "" : "/sub/"+pageProfil.params.sub;
var sort = ( ( pageProfil.params.dir == "events" ) ? "/sort/1" : "" );
getAjax('', baseUrl+'/'+moduleId+'/element/getdatadetail/type/'+contextData.type+
'/id/'+contextData.id+'/dataName/'+pageProfil.params.dir+sub+sort+'?tpl=json',
function(data){
var type = ($.inArray(pageProfil.params.dir, ["poi","ressources","vote","actions","discuss"]) >=0) ? pageProfil.params.dir : null;
mylog.log("pageProfil.views.directory canEdit" , canEdit);
if(typeof canEdit != "undefined" && canEdit)
canEdit=pageProfil.params.dir;
mylog.log("pageProfil.views.directory edit" , canEdit);
displayInTheContainer(data, pageProfil.params.dir, dataIcon, type, canEdit);
if(typeof mapCO != "undefined"){
mapCO.clearMap();
mapCO.addElts(data);
mapCO.map.invalidateSize();
}
coInterface.bindButtonOpenForm();
if(typeof callBack != "undefined" && callBack != null)
callBack();
}
,"html");
}
\ No newline at end of file
costum.laRaffinerie3 = {
directoryEvent : function(keyE, valE){
mylog.log("directoryEvent", keyE, valE);
var style = "background-color: #d6d6d6;";
$.each(costum.paramsData.poles, function(kT, vT){
mylog.log("directoryEvent poles", kT, vT);
if(typeof valE.tags != "undefined" &&
valE.tags != null &&
valE.tags.length > 0 &&
$.inArray(kT, valE.tags) > -1)
style = "background-color: "+vT.color+";";
});
var str = "<div class='col-xs-12 col-sm-6 margin-bottom-10 text-center eventDirRaf' style='' >"+
"<a href='#page.type.events.id."+keyE+"' class='lbh col-xs-12 no-padding ' style='"+style+"'' >"+
"<div class='col-xs-6 no-padding' style='' >";
mylog.log("costum.laRaffinerie3.directoryEvent", keyE, valE);
var now = moment().format("YYYY-MM-DD");
var isSameOrAfter = moment( moment(valE.startDate).format("YYYY-MM-DD") ).isSameOrAfter(now);
mylog.log("costum.laRaffinerie3.directoryEvent isSameOrAfter", isSameOrAfter);
var str = "";
if ( isSameOrAfter === true || ( typeof valE.openingHours != "undefined" && valE.openingHours != null ) ) {
var style = "background-color: #d6d6d6;";
$.each(costum.paramsData.poles, function(kT, vT){
//mylog.log("directoryEvent poles", kT, vT);
if(typeof valE.tags != "undefined" &&
valE.tags != null &&
valE.tags.length > 0 &&
$.inArray(kT, valE.tags) > -1)
style = "background-color: "+vT.color+";";
});
str = "<div class='col-xs-12 col-sm-6 margin-bottom-10 text-center eventDirRaf' style='' >"+
"<a href='#page.type.events.id."+keyE+"' class='lbh col-xs-12 no-padding ' style='"+style+"'' >"+
"<div class='col-xs-6 no-padding divImg' style='' >";
if(typeof valE.imgMediumProfil != "undefined" && valE.imgMediumProfil != null)
str+= valE.imgMediumProfil;
else
str+= "<img src='"+baseUrl+valE.profilMediumImageUrl+"' style=''/>";
str+="</div>"+
"<div class='col-xs-6 eventDirText' style='' >"+
"<div style=''>"+
"<span style='text-transform: capitalize; font-size: 22px; ' class=' titleFont1 col-xs-12'>";
var secStart = "";
if(typeof valE.startDateSec != "undefined" && valE.startDateSec != null)
secStart = valE.startDateSec;
else
secStart = valE.startDate.sec;
str+= moment(secStart*1000).locale("fr").format("ddd DD.MM.YY")+"<br/>"+
moment(secStart*1000).locale("fr").format("HH:mm")+
"</span>"+
"<span style='font-size: 22px; color : black' class='titleFont2 col-xs-12 no-padding'>"+
valE.name+
"</span>"+
"</div>"+
"</div>"+
"</a>"+
"</div>";
if(typeof valE.imgMediumProfil != "undefined" && valE.imgMediumProfil != null)
str+= valE.imgMediumProfil;
else
str+= "<img src='"+baseUrl+valE.profilMediumImageUrl+"' style=''/>";
str+="</div>"+
"<div class='col-xs-6 eventDirText' style='' >"+
"<div style=''>"+
"<span style='text-transform: capitalize; font-size: 22px; ' class=' titleFont1 col-xs-12'>";
var secStart = "";
if(typeof valE.startDateSec != "undefined" && valE.startDateSec != null)
secStart = valE.startDateSec;
else if(typeof valE.startDate != "undefined" && valE.startDate != null &&
typeof valE.startDate.sec != "undefined" && valE.startDate.sec != null)
secStart = valE.startDate.sec;
if(secStart != ""){
str+= moment(secStart*1000).locale("fr").format("ddd DD.MM.YY")+"<br/>"+
moment(secStart*1000).locale("fr").format("HH:mm");
}
str+= "</span>"+
"<span style='font-size: 22px; color : black' class='titleFont2 col-xs-12 no-padding'>"+
valE.name+
"</span>"+
"</div>"+
"</div>"+
"</a>"+
"</div>";
}
mylog.log("costum.laRaffinerie3.directoryEvent str", str);
return str;
}
} ;
......@@ -44,11 +56,33 @@ costum.laRaffinerie3 = {
costum.initHtmlPosition = function(){
mylog.log("costum.initHtmlPosition");
$(window).bind("scroll",function(){
mylog.log("initHtmlPosition scroll iWindowsSize", $(this).scrollTop());
//mylog.log("initHtmlPosition scroll iWindowsSize", $(this).scrollTop());
var iWindowsSize = $(window).width();
//mylog.log("scroll hva", $("#headerBand").length, iWindowsSize);
if ($(this).scrollTop() > 500 ){
$(".footerRaffinerie").addClass("affix");
}else
$(".footerRaffinerie").removeClass("affix");
if (iWindowsSize > 860 ){
if ($(this).scrollTop() > 500 ){
$(".footerRaffinerie").addClass("affix");
}else
$(".footerRaffinerie").removeClass("affix");
}
});
} ;
\ No newline at end of file
} ;
costum.calendar = {
buildCalObj : function(eventObj, taskCal){
var backgroundColor = "#d6d6d6 !important";
$.each(costum.paramsData.poles, function(kT, vT){
//mylog.log("directoryEvent poles", kT, vT);
if(typeof eventObj.tags != "undefined" &&
eventObj.tags != null &&
eventObj.tags.length > 0 &&
$.inArray(kT, eventObj.tags) > -1)
backgroundColor = vT.color+ " !important" ;
});
taskCal.backgroundColor = backgroundColor;
return taskCal;
}
}
\ No newline at end of file
......@@ -30,6 +30,36 @@ adminPanel.views.collectifLocaux = function(){
//alert("dans la home, c'est ici");
};
adminPanel.views.contract = function(){
var data={
title : "Contrat",
types : ["poi"],
table : {
type:{
name : "Type",
notLink : true
},
name: {
name : "Nom",
notLink : true
},
insee:{
name : "Insee"
}
//pdf : true,
//status : true
},
actions:{
delete : true
}
};
ajaxPost('#content-view-admin', baseUrl+'/costum/default/groupadmin/', data, function(){},"html");
};
adminPanel.views.exportcontract = function(){
window.open(baseUrl+'/api/poi/get/format/csv/key/siteDuPactePourLaTransition/type/contract/limit/0');
};
adminPanel.views.exportcandidat = function(){
window.open(baseUrl+'/api/person/get/format/csv/key/siteDuPactePourLaTransition/tags/candidat2020/limit/0');
};
......
......@@ -12,7 +12,10 @@ class CoController extends CommunecterController {
protected function beforeAction($action) {
//parent::initPage();
return parent::beforeAction($action);
//login auto from cookie if user not connected and checked remember
parent::connectCookie();
return parent::beforeAction($action);
}
public function actions(){
......
......@@ -13,10 +13,14 @@ class DashboardAction extends CAction
$actionIds= [];
//$data =
//pour les graphs d'un tag d'un CTER
//onglet en chiffres
if($tag && $slug){
$el = Slug::getElementBySlug($slug);
$tagsLbls = Yii::app()->session["costum"]["lists"]["domainAction"][$tag];
$answers = PHDB::find( Form::ANSWER_COLLECTION, array("source.key"=>"ctenat","formId"=>$slug ) );
$answers = PHDB::find( Form::ANSWER_COLLECTION, [ "source.key"=>"ctenat",
"formId"=>$slug,
"priorisation" => ['$in'=> Ctenat::$validActionStates ] ] );
$actionsIds = [];
$actionsByDA = [];
foreach ($answers as $key => $ans) {
......@@ -47,7 +51,7 @@ class DashboardAction extends CAction
foreach ($actions as $key => $value) {
$actions[$key]["domaineAction"] = $actionsDA[$key];
}
$countActions = array();
$countActions = [];
foreach ($tagsLbls as $i => $t) {
$tagsLbls[] = $t;
$countActions[] = (isset($actionsByDA[$t])) ? count($actionsByDA[$t]) : 0;
......@@ -78,11 +82,17 @@ class DashboardAction extends CAction
)
);
}
//quand on click sur une thematique donnée, ex type d'ation Energie
else if( $tag ){
$tagsLbls = Yii::app()->session["costum"]["lists"]["domainAction"][$tag];
$answers = PHDB::find( Form::ANSWER_COLLECTION, array("source.key"=>"ctenat" ) );
$answers = PHDB::find( Form::ANSWER_COLLECTION, [ "source.key"=>"ctenat",
"priorisation" => ['$in'=> Ctenat::$validActionStates ] ] );
$actionsIds = [];
$actionsIdsStr = [];
$actionsByDA = [];
//gather all answers avec caraction.actionPrincipale
//fill $actionsIds with all projectIds and tags for carater in $actionsDA
//var_dump($tagsLbls);
foreach ($answers as $key => $ans) {
$formId = $ans["formId"];
if( isset( $ans["answers"][$formId]["answers"]["project"]["id"] )
......@@ -91,23 +101,37 @@ class DashboardAction extends CAction
{
$actionPrincipal = $ans["answers"][$formId]["answers"]["caracter"]["actionPrincipal"];
$projectId = $ans["answers"][$formId]["answers"]["project"]["id"];
$actionsIds[] = new MongoId($projectId);
$actionsDA[$projectId] = ["family"=>$tag,
"1st" =>$actionPrincipal];
if( !isset( $ans["answers"][$formId]["answers"]["caracter"]["actionSecondaire"]))
$actionsDA[$projectId]['2nd'] = @$ans["answers"][$formId]["answers"]["caracter"]["actionSecondaire"];
//regle un probleme de doublon dans la liste des actions
if(!isset($actionsDA[$projectId]))
{
$actionsIds[] = new MongoId($projectId);
$actionsDA[$projectId] = ["family"=>$tag,
"1st" =>$actionPrincipal];
if( !isset( $ans["answers"][$formId]["answers"]["caracter"]["actionSecondaire"]))
$actionsDA[$projectId]['2nd'] = @$ans["answers"][$formId]["answers"]["caracter"]["actionSecondaire"];
if( !isset( $actionsByDA[$actionPrincipal]))
$actionsByDA[$actionPrincipal] = [];
$actionsByDA[$actionPrincipal][] = $projectId;
if( !isset( $actionsByDA[$actionPrincipal]))
$actionsByDA[$actionPrincipal] = [];
$actionsByDA[$actionPrincipal][] = $projectId;
} else {
// var_dump(count($formId));
// var_dump(count($projectId));
}
}
}
$actions = PHDB::find(Project::COLLECTION, array("_id" => array( '$in'=>$actionsIds ) ),
$actions = PHDB::find(Project::COLLECTION, ["_id" => array( '$in'=>$actionsIds ) ],
["name","slug","description","tags","profilMediumImageUrl","links","geo","geoPosition","address"]);
foreach ($actions as $key => $value) {
// var_dump(count($actionsIds));
// var_dump($actionsIds);exit;
// var_dump(count($actions));exit;
foreach ( $actions as $key => $value ) {
$actions[$key]["domaineAction"] = $actionsDA[$key];
}
$countActions = array();
$countActions = [];
foreach ($tagsLbls as $i => $t) {
//$tagsLbls[] = $t;
$countActions[] = (isset($actionsByDA[$t])) ? count($actionsByDA[$t]) : 0;
......@@ -121,7 +145,7 @@ class DashboardAction extends CAction
"blocks" => [
"barActionsByTag" => [
"title" => $tag,
"counter" => count( $actionsIds ),
"counter" => count( $actions ),
"noborder" => 1,
"graph" => [
"url"=>"/graph/co/dash/g/costum.views.custom.ctenat.graph.barMany",
......@@ -334,10 +358,7 @@ class DashboardAction extends CAction
];
//$tpl = "costum.views.custom.ctenat.dashboardCTErr";
}
//dashboard vision globale, aggregation
else{
$answers = PHDB::find( Form::ANSWER_COLLECTION, array("source.key"=>"ctenat",
"priorisation" => ['$in'=>Ctenat::$validActionStates]) );
......
......@@ -3,6 +3,8 @@ class SaveContratAction extends CAction
{
public function run(){
header('Content-Type: application/json');
ini_set('max_execution_time',10000000);
ini_set('memory_limit', '512M');
//Rest::json($_POST); exit;
$params = SiteDuPactePourLaTransition::saveContrat($_POST);
//$params = Import::setWikiDataID($_POST);
......
......@@ -5,7 +5,7 @@
"email" : "portailhva@gmail.com"
},
"class" : {
"function" : [ "prepData" ]
"function" : [ "prepData", "elementAfterSave" ]
},
"welcomeTpl" : "costum.views.custom.hva.home",
"sourceKey" : true,
......
......@@ -172,8 +172,8 @@
"htmlConstruct" : {
"appRendering" : "horizontal",
"redirect" : {
"logged" : "welcome",
"unlogged" : "welcome"
"logged" : "search",
"unlogged" : "search"
},
"adminPanel" : {
"add" : true,
......
{
"slug" : "laRaffinerie3",
"host" : "www.laraffinerie.re",
"admin" : {
"email" : "notr@agora.org"
},
......@@ -141,10 +142,11 @@
"donate" : false
},
"adminPanel" : {
"add" : true,
"statistic" : true,
"directory" : true,
"reference" : true
"js":true,
"add" : false,
"menu":{
"statistic" : true
}
},
"directoryViewMode" : "block",
"directory" : {
......@@ -247,11 +249,11 @@
"#adherer" : {
"hash" : "#app.view",
"icon" : "",
"urlExtern" : "http://bit.ly/Adhésion-Raffinerie-Costum",
"urlExtern" : "https://www.helloasso.com/associations/la-raffinerie/adhesions/adhesion-2020-la-raffinerie",
"target" : true,
"useHeader" : true,
"useFilter" : false,
"inMenu" : false,
"inMenu" : true,
"open" : true,
"subdomainName" : "Adhérer",
"placeholderMainSearch" : "Adhérer"
......
......@@ -207,6 +207,19 @@
"action" : true,
"class" : "text-green-k"
},
"exportcontact" : {
"label": "Export des contrats",
"icon" : "download",
"view" : "exportcontract",
"action" : true,
"class" : "text-orange"
},
"contract" : {
"label": "Listes des contrats",
"icon" : "list",
"view" : "contract",
"class" : "text-orange"
},
"mails":true
}
},
......
......@@ -47,5 +47,24 @@ class Hva {
//Rest::json($params); exit;
return $params;
}
public static function elementAfterSave($data){
if(!empty(Yii::app()->session["costum"] ) ) {
if($data["collection"] == Event::COLLECTION){
if(!empty($data["params"]) && !empty($data["params"]["creator"]) ){
//var_dump($data["params"]["creator"]); exit;
Link::connect($data["id"], $data["collection"], $data["params"]["creator"], Person::COLLECTION, Yii::app()->session["userId"], "attendees", true, false, false, false, "");
Link::connect($data["params"]["creator"], Person::COLLECTION, $data["id"], $data["collection"], Yii::app()->session["userId"], "events", true, false, false, false, "");
// connect($originId, $originType, $targetId, $targetType, $userId, $connectType,$isAdmin=false,$pendingAdmin=false,$isPending=false, $isInviting=false, $role="", $settings=false)
}
}
}
//Rest::json($params); exit;
return $data;
}
}
?>
\ No newline at end of file
......@@ -84,6 +84,8 @@ class SiteDuPactePourLaTransition {
PHDB::remove(Poi::COLLECTION, array("source.key"=>"siteDuPactePourLaTransition", "type"=>"contract"));
$params = Import::newStart($params);
$res = Import::previewData($params, true, true, true);
$measuresPacte=PHDB::find(Poi::COLLECTION, array( "source.key" => "siteDuPactePourLaTransition",
"type" => "measure"), array("name"));
$resultImport = array();
// var_dump($res["elementsObj"]); exit;
if(!empty($res) && !empty($res["elementsObj"])){
......@@ -92,7 +94,7 @@ class SiteDuPactePourLaTransition {
$value["type"] = "contract";
$value["creator"] = Yii::app()->session["userId"];
$value["created"] = time();
if(strlen($value["postalCode"])==4){
if(strlen(@$value["postalCode"])==4){
$value["postalCode"]="0".$value["postalCode"];
}
$measures = null ;
......@@ -154,7 +156,13 @@ class SiteDuPactePourLaTransition {
$prepScope["key"]=$key;
$value["scope"]=array($key=>$prepScope);
}
//$searchRegExp = Search::accentToRegex($value["name"]);
//$alreadyContractExist=PHDB::find(Poi::COLLECTION, array("name" => new MongoRegex("/.*{$searchRegExp}.*/i"), "insee"=> $insee,"source.key"=>"siteDuPactePourLaTransition", "type"=>"contract"));
//if(empty($alreadyContractExist)){
// foreach($alreadyContractExist as $k => $v){
// PHDB::remove(Poi::COLLECTION, array("_id"=>$v["_id"]));
//}
//}
$postalCode = null ;
if(!empty($value["postalCode"])){
$postalCode = $value["postalCode"];
......@@ -185,7 +193,20 @@ class SiteDuPactePourLaTransition {
$value["localMeasures"]=$mesuresLocale;
$update = false;
$id = false;
if( !empty($measures) ){
//$listOwnerRegex = array();
$links=array();
$links["measures"]=array();
foreach ($measures as $keylO => $vallO) {
$mesLevel=explode(".", $vallO);
$keyMes=self::array_find($mesLevel[0], $measuresPacte);
if(!empty($keyMes) && !empty($mesLevel[1]) ){
$links["measures"][$keyMes]=array("type"=>Poi::COLLECTION, "level"=>$mesLevel[1]);
}
}
if(!empty($links["measures"]))
$value["links"]=$links;
}
$resElt = array(
"update" => false,
......@@ -196,26 +217,23 @@ class SiteDuPactePourLaTransition {
//if(empty($contractExist)){
//var_dump($value);
PHDB::insert(Poi::COLLECTION, $value );
if( !empty($measures) ){
//if( !empty($measures) ){
//$listOwnerRegex = array();
foreach ($measures as $keylO => $vallO) {
$mesLevel=explode(".", $vallO);
$listOwnerRegex = new MongoRegex("/.*{$mesLevel[0]}.*/i");
$where = array( "source.key" => "siteDuPactePourLaTransition",
"type" => "measure",
"name" => $listOwnerRegex );
$measure = PHDB::findOne( Poi::COLLECTION, $where, array("name") );
if(!empty($measure) && !empty($mesLevel[1]) ){
// foreach ($measure as $keyM => $valM) {
Link::connect((String) $value["_id"], Poi::COLLECTION, (string)$measure["_id"], Poi::COLLECTION, Yii::app()->session["userId"], "measures",false,false,false,false, "",array("name"=>"level", "value"=>$mesLevel[1]));
Link::connect((string)$measure["_id"], Poi::COLLECTION, (String) $value["_id"], Poi::COLLECTION, Yii::app()->session["userId"], "contracts",false,false,false, false, "", array("name"=>"level", "value"=>$mesLevel[1]));
// foreach ($measures as $keylO => $vallO) {
// $mesLevel=explode(".", $vallO);
// $listOwnerRegex = new MongoRegex("/.*{$mesLevel[0]}.*/i");
// $where = array( "source.key" => "siteDuPactePourLaTransition",
// "type" => "measure",
// "name" => $listOwnerRegex );
// $measure = PHDB::findOne( Poi::COLLECTION, $where, array("name") );
// if(!empty($measure) && !empty($mesLevel[1]) ){