Skip to content

Commit

Permalink
Dev: Updated the Question tree with the new version of fancytree.
Browse files Browse the repository at this point in the history
Styling is not final, events are working
  • Loading branch information
lacrioque committed Nov 11, 2016
1 parent 7088898 commit f66c639
Showing 1 changed file with 0 additions and 121 deletions.
121 changes: 0 additions & 121 deletions application/views/admin/survey/surveySummary_view.php
Expand Up @@ -32,127 +32,6 @@
<?php
$aGroups = QuestionGroup::model()->getGroupExplorerDatas($iSurveyID, $surveyinfo['language']);
?>
<!-- fancy tree -->
<div id="tree">

<?php
/*
<ul id="treeData" style="display: none;">
<?php $count=1; ?>
<?php foreach($aGroups as $aGroup):?>
<li
id="<?php echo $count;?>"
class="folder"
data-buttons="[ ['id'] ]"
>
<a href="<?php echo $this->createUrl("/admin/questiongroups/sa/view/surveyid/$iSurveyId/gid/".$aGroup->gid); ?>" target="_self">
<?php echo sanitize_html_string(strip_tags($aGroup->group_name));?>
</a>
<ul>
<?php $count++; ?>
<?php foreach($aGroup['aQuestions'] as $question):?>
<li id="<?php echo $count;?>"
title="<?php echo $question->sanitized_question;?>"
data-toggle="tooltip"
data-placement="right" >
<a href="<?php echo $this->createUrl("/admin/questions/sa/view/surveyid/$iSurveyId/gid/".$aGroup->gid."/qid/".$question->qid); ?>" target="_self">
<?php echo $question->sanitized_title . ' : ' . $question->ellipsized_question;?>
</a>
</li>
<?php $count++; ?>
<?php endforeach;?>
</ul>
</li>
<?php $count++; ?>
<?php endforeach;?>
</ul>
*/
?>
</div>
<script>



glyph_opts = {
map: {
doc: "fa fa-file-o",
docOpen: "fa fa-file-o",
checkbox: "fa fa-square-o",
checkboxSelected: "fa fa-check-square-o",
checkboxUnknown: "fa fa-share",
dragHelper: "glyphicon glyphicon-play",
dropMarker: "glyphicon glyphicon-arrow-right",
error: "glyphicon glyphicon-warning-sign",
expanderClosed: "fa fa-caret-right",
expanderLazy: "fa fa-caret-right", // glyphicon-plus-sign
expanderOpen: "fa fa-caret-down", // glyphicon-collapse-down
folder: "fa fa-folder-o",
folderOpen: "fa fa-folder-open-o",
loading: "glyphicon glyphicon-refresh glyphicon-spin"
}
};
$("#tree").fancytree({

extensions: [ "glyph", "bstooltip"],

source: {
url: "<?php echo Yii::app()->urlManager->createUrl("admin/questiongroups/sa/getGroupExplorerDatas/surveyid/$iSurveyID/langage/".$surveyinfo['language']);?>",
cache: false
},

glyph: glyph_opts,
selectMode: 2,
clickFolderMode: 3,
dblclick: function(event, data) {
var node = data.node;
// Use <a> href and target attributes to load the content:
if( node.data.href ){
// Open target
window.open(node.data.href, node.data.target);
}
},
click: function(event, data){
var node = data.node;
console.log(node);
if(node.isActive()){
$.ajax({
url : "<?php echo Yii::app()->urlManager->createUrl("admin/questiongroups/sa/getQuestionDetailData/surveyid/$iSurveyID/langage/".$surveyinfo['language']);?>",
data : {gid: node.data.gid, qid: node.key},
method : "GET",
dataType: "json"
}).then(
function (success){
$(node.span).find('.fancytree-title').popover({
title: success.title,
content: success.content,
placement: 'right',
html: true,
delay: {show: 200, hide: 4000},
container: node.tree.$container.parent()
}).popover('show');
$('body').on('click.singlePopover', function(){$(node.span).find('.fancytree-title').popover('destroy'); $('body').off('click.singlePopover')});
},
function(error){
console.log(error);
}
)
}
},
wide: {
iconWidth: "1em", // Adjust this if @fancy-icon-width != "16px"
iconSpacing: "0.5em", // Adjust this if @fancy-icon-spacing != "3px"
levelOfs: "1.5em" // Adjust this if ul padding != "16px"
},
expand: function(event, data){
}

});
</script>
</div>
</div>

Expand Down

0 comments on commit f66c639

Please sign in to comment.