Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
14abf16
change highcharts to highstock- get the events from WS - events on th…
jbonnefont Sep 27, 2019
0d7bfa5
optimisation
jbonnefont Sep 30, 2019
c2936bd
little changes on images rendering
jbonnefont Sep 30, 2019
3999d76
events flag highstocks: on datagrouping false effect & time axis bug:
jbonnefont Sep 30, 2019
dd5db3b
events visualization: catch exception on EventSearch to search events…
jbonnefont Oct 1, 2019
8b39a12
start the branch
jbonnefont Oct 2, 2019
1c0bacc
Merge branch 'master' into event-visualization-2
jbonnefont Oct 2, 2019
f1a6077
clic event on the serie- start the create popup - some exception/toke…
jbonnefont Oct 3, 2019
f7c0964
stuff
jbonnefont Oct 4, 2019
e10821e
Images serie attached to data serie- images visualization on click
jbonnefont Oct 9, 2019
2567464
hover effect on images to see the flags on graphic
jbonnefont Oct 9, 2019
39f25f5
Add create event action + change submit action on visualized from PO…
jbonnefont Oct 10, 2019
9431a0a
highlight images on graphic points hover + start to add events view l…
jbonnefont Oct 11, 2019
11b7777
Show events details on popup (clic on event's flag) : first part
jbonnefont Oct 14, 2019
c93109c
hide tootip on photo's flag+ custom color of flags
jbonnefont Oct 14, 2019
61ab866
little ergonomic changes / delete the detail view modal on Events fla…
jbonnefont Oct 15, 2019
4d17ed3
set allowOverlapX to false on Events flag serie + Set Zoom to XY
jbonnefont Oct 15, 2019
df298c9
stuff
jbonnefont Oct 15, 2019
ac5f852
fix events flag superpose at same date : highstock needs ordered dates
jbonnefont Oct 15, 2019
5f2672b
Add detail events modal on the event's flag clic
jbonnefont Oct 15, 2019
1cd3dd7
variable label on the y axis label and graphic title
jbonnefont Oct 16, 2019
d96dfee
internationalization+comment
jbonnefont Oct 16, 2019
e3b35ba
Fix provenances/data link
jbonnefont Oct 18, 2019
5fb3798
Add annotations on click and show annotations widget / fix annotation…
jbonnefont Oct 23, 2019
20097e2
fix url size to 1500
jbonnefont Oct 24, 2019
5fc80ef
pjax on the annotations and events widgets /fix pagination parameter
jbonnefont Oct 25, 2019
83778d2
link annotations to events to build a detailed events table
jbonnefont Oct 28, 2019
b23503b
Visualization : detailed events and annotation table : fix pjax call…
jbonnefont Oct 29, 2019
4ae979f
Visualization : detailed events with annotations on hover in the tool…
jbonnefont Oct 30, 2019
6c114a6
Merge branch 'master' into visualization-annotation-so
jbonnefont Oct 30, 2019
0bd7b38
Visualization :no more click event on event serie
jbonnefont Oct 30, 2019
a1e102a
Visualization :no more click event on event serie : fix
jbonnefont Oct 30, 2019
75ff699
Visualization :events tooltip style
jbonnefont Oct 30, 2019
e9198bd
fix YiiEventModel::TYPE
jbonnefont Oct 30, 2019
1469406
fix large tooltip text in highcharts / reduce modal to show the add e…
jbonnefont Oct 31, 2019
60e3185
fix pjax with link _blank on action in event/annotation table view
jbonnefont Nov 4, 2019
0d3405b
increase timeout parameter of the pjax option cause of the long time …
jbonnefont Nov 4, 2019
95f32b9
Clean code before pull request
jbonnefont Nov 8, 2019
54de765
some cleaning code changes during the getEvents without Events WS fix…
jbonnefont Nov 29, 2019
a5ecae7
Fix annotation create
jbonnefont Dec 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 45 additions & 40 deletions components/widgets/AnnotationGridViewWidget.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

//******************************************************************************
// AnnotationGridViewWidget.php
// SILEX-PHIS
// Copyright © INRA 2018
// Creation date: 23 Aug. 2018
// Contact: arnaud.charleroy@inra.fr, anne.tireau@inra.fr, pascal.neveu@inra.fr
//******************************************************************************

namespace app\components\widgets;

use yii\base\Widget;
Expand All @@ -18,14 +20,15 @@

/**
* Annotation grid view widget.
* @update [Bonnefont Julien] 8 Novembre, 2019: add an easy reading format to the date and type
* @author Arnaud Charleroy <arnaud.charleroy@inra.fr>
*/
class AnnotationGridViewWidget extends Widget {

CONST ANNOTATIONS = "annotations";
CONST NO_LINKED_ANNOTATIONS = "No linked Annotation(s)";
CONST LINKED_ANNOTATIONS = "Linked Annotation(s)";

/**
* Define the annotations list which will be showed
* @var mixed
Expand All @@ -50,47 +53,49 @@ public function run() {
} else {
$htmlRendered = "<h3>" . Yii::t('app', self::LINKED_ANNOTATIONS) . "</h3>";
$htmlRendered .= GridView::widget([
'dataProvider' => $this->annotations,
'columns' => [
[
'label' => Yii::t('app',YiiAnnotationModel::BODY_VALUES_LABEL),
'attribute' => YiiAnnotationModel::BODY_VALUES,
'value' => function ($model) {
return implode(("<br />"), $model->bodyValues);
},
'format' => 'raw',
],
YiiAnnotationModel::CREATOR =>
[
'label' => Yii::t('app',YiiAnnotationModel::CREATOR_LABEL),
'attribute' => YiiAnnotationModel::CREATOR,
'value' => function($model) {
return Vocabulary::prettyUri($model->creator);
},
],
YiiAnnotationModel::MOTIVATED_BY =>
[
'label' => Yii::t('app',YiiAnnotationModel::MOTIVATED_BY_LABEL),
'attribute' => YiiAnnotationModel::MOTIVATED_BY,
'value' => function($model) {
return Vocabulary::prettyUri($model->motivatedBy);
}
],
[
'label' => Yii::t('app',YiiAnnotationModel::CREATION_DATE_LABEL),
'attribute' => YiiAnnotationModel::CREATION_DATE
],
['class' => 'yii\grid\ActionColumn',
'template' => '{view}',
'buttons' => [
'view' => function($url, $model, $key) {
return Html::a(Icon::show('eye-open', [], Icon::BSG), ['annotation/view', 'id' => $model->uri]);
},
]
],
],
'dataProvider' => $this->annotations,
'columns' => [
[
'label' => Yii::t('app', YiiAnnotationModel::BODY_VALUES_LABEL),
'attribute' => YiiAnnotationModel::BODY_VALUES,
'value' => function ($model) {
return implode(("<br />"), $model->bodyValues);
},
'format' => 'raw',
],
YiiAnnotationModel::CREATOR =>
[
'label' => Yii::t('app', YiiAnnotationModel::CREATOR_LABEL),
'attribute' => YiiAnnotationModel::CREATOR,
'value' => function($model) {
return explode("agent/", $model->creator)[1];
},
],
YiiAnnotationModel::MOTIVATED_BY =>
[
'label' => Yii::t('app', YiiAnnotationModel::MOTIVATED_BY_LABEL),
'attribute' => YiiAnnotationModel::MOTIVATED_BY,
'value' => function($model) {
return explode("#", $model->motivatedBy)[1];
}
],
[
'label' => Yii::t('app', YiiAnnotationModel::CREATION_DATE_LABEL),
'format' => ['date', 'php:Y-m-d H:i'],
'attribute' => YiiAnnotationModel::CREATION_DATE
],
['class' => 'yii\grid\ActionColumn',
'template' => '{view}',
'buttons' => [
'view' => function($url, $model, $key) {
return Html::a(Icon::show('eye-open', [], Icon::BSG), ['annotation/view', 'id' => $model->uri]);
},
]
],
],
]);
}
return $htmlRendered;
}

}
8 changes: 8 additions & 0 deletions components/widgets/PropertyWidgetWithActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@
* @author Andréas Garcia <andreas.garcia@inra.fr>
*/
class PropertyWidgetWithActions extends PropertyWidget {
protected function renderValue($value): string {

}

protected function renderValues($values): string {

}

}
111 changes: 111 additions & 0 deletions components/widgets/event/DetailEventGridViewWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?php

//******************************************************************************
// EventGridViewWidget.php
// SILEX-PHIS
// Copyright © INRA 2019
// Creation date: 5 Mar. 2019
// Contact: julien.bonnefont@inra.fr, anne.tireau@inra.fr, pascal.neveu@inra.fr
//******************************************************************************

namespace app\components\widgets\event;

use yii\base\Widget;
use yii\helpers\Html;
use yii\grid\GridView;
use Yii;
use app\models\yiiModels\YiiEventModel;
use kartik\icons\Icon;

/**
* Detail Event GridView widget.
* @author Julien Bonnefont <julien.bonnefont@inra.fr>
*/
class DetailEventGridViewWidget extends Widget {

const EVENTS_LABEL = "Events";
const NO_EVENT_LABEL = "No events";
const EVENTS_ARE_NOT_SET_LABEL = "Events aren't set";
const HTML_CLASS = "event-widget";

/**
* Defines the list of events to show.
* @var mixed
*/
public $dataProvider;

const DATA_PROVIDER = "dataProvider";

public function init() {
parent::init();
// must be not null
if ($this->dataProvider === null) {
throw new \Exception(self::EVENTS_ARE_NOT_SET_LABEL);
}
}

/**
* Renders the list of the concerned items.
* @return string the HTML string rendered
*/
public function run() {
if ($this->dataProvider->getCount() == 0) {
$htmlRendered = "<h3>" . Yii::t('app', self::NO_EVENT_LABEL) . "</h3>";
} else {
$htmlRendered = "<h3>" . Yii::t('app', self::EVENTS_LABEL) . "</h3>";
$htmlRendered .= GridView::widget([
'dataProvider' => $this->dataProvider,
'columns' => [
[
'label' => Yii::t('app', 'Type'),
'attribute' => YiiEventModel::TYPE,
'value' => function ($model) {
return explode("#", $model->rdfType)[1];
}
],
[
'label' => Yii::t('app', YiiEventModel::ANNOTATIONS),
'attribute' => YiiEventModel::ANNOTATIONS,
'format' => 'html',
'value' => function ($model) {

$annotations = $model->annotations;

$toReturn = '';
$marginLeft = 0;
foreach ($annotations as $annotation) {

$toReturn .= '<div class="well well-lg" style="margin:0px 0px 5px ' . $marginLeft . 'px;">';
foreach ($annotation['bodyValues'] as $i => $value) {
$toReturn .= $value . ' ';
}
$marginLeft += 10;
$toReturn .= '<div class="pull-right">';
$toReturn .= date('d/m/Y H:i', strtotime($annotation['creationDate']));
$toReturn .= '</div></div>';
}
return $toReturn;
}
],
[
'format' => ['date', 'php:d/m/Y H:i'],
'attribute' => YiiEventModel::DATE
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view}',
'buttons' => [
'view' => function($url, $model, $key) {
return Html::a(
Icon::show('eye-open', [], Icon::BSG), ['event/view', 'id' => $model->uri]);
},
]
],
],
'options' => ['class' => self::HTML_CLASS]
]);
}
return $htmlRendered;
}

}
9 changes: 6 additions & 3 deletions components/widgets/event/EventButtonWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ class EventButtonWidget extends Widget {
const CONCERNED_ITEMS_URIS = "concernedItemsUris";

/**
* Defines the type of object which will be annotated.
* Defines to wich type of model the event will be create ( scientific object, vector, sensor..).
* @var array
*/
public $type;

const TYPE = "type";

public $size="";

const SIZE="size";
/**
* Renders the event button.
* @return string the string rendered
Expand All @@ -67,10 +70,10 @@ public function run() {
EventController::PARAM_RETURN_URL => Url::current()
];
if (!$this->asLink) {
$linkLabel = Icon::show('flag', [], Icon::FA) . " " . Yii::t('app', self::ADD_EVENT_LABEL);
$linkLabel = Icon::show('flag', ['class'=>$this->size], Icon::FA) . " " . Yii::t('app', self::ADD_EVENT_LABEL);

} else {
$linkLabel = '<span class="fa fa-flag"></span>';
$linkLabel =Icon::show('flag', ['class'=>$this->size], Icon::FA);
}
if(!isset($this->type)){
$linkAttributes = ['class' => 'btn btn-default'];
Expand Down
2 changes: 1 addition & 1 deletion components/widgets/event/EventGridViewWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function run() {
'label' => Yii::t('app', YiiEventModel::TYPE),
'attribute' => YiiEventModel::TYPE,
'value' => function ($model) {
return Vocabulary::prettyUri($model->rdfType);
return explode("#", $model->rdfType)[1];
}
],
[
Expand Down
5 changes: 4 additions & 1 deletion config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,14 @@
'labelView:side90','labelView:side120','labelView:side150','labelView:side180','labelView:side210',
'labelView:side240','labelView:side270','labelView:side300','labelView:side330',
],
]
],
// // Image filters GENERIC
// 'image.filter' => [
// 'metadata.position' => [
// 'label1:value1','label2:value2', 'label3:value3'],
// ]
//Highcharts color
'highchartsColor' =>["#7cb5ec", "#434348", "#90ed7d", "#f7a35c", "#8085e9", "#f15c80", "#e4d354", "#2b908f",
"#f45b5b", "#91e8e1", "#7cb5ec", "#434348", "#90ed7d", "#f7a35c", "#8085e9", "#f15c80", "#e4d354", "#2b908f", "#f45b5b", "#91e8e1"]

];
4 changes: 2 additions & 2 deletions controllers/AnnotationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function actionCreate($attributes = null) {
$dataToSend[] = $annotationModel->attributesToArray();
// Send data
$requestRes = $annotationModel->insert($sessionToken, $dataToSend);

if (is_string($requestRes) && $requestRes === \app\models\wsModels\WSConstants::TOKEN_INVALID) { // User must be connected
return $this->redirect(Yii::$app->urlManager->createUrl("site/login"));
} else {
Expand Down Expand Up @@ -94,8 +95,7 @@ public function actionIndex() {
// Load user instances list
$userModel = new YiiUserModel();
$users = $userModel->getPersonsURIAndName(Yii::$app->session[\app\models\wsModels\WSConstants::ACCESS_TOKEN]);

// Load once motivation instances list
// Load once motivation instances list
$motivationInstances = $this->getMotivationInstances();
if (is_string($searchResult)) {
if ($searchResult === \app\models\wsModels\WSConstants::TOKEN_INVALID) {
Expand Down
Loading