如何映射树结构的动态数据

时间:2017-03-09 05:56:36

标签: php mysql tree

我需要在层次结构级别的树结构中映射动态渲染数据 喜欢分工,名称,内容。

http://www.jqueryscript.net/demo/Smoot-Collapsible-Tree-View-Plugin-with-jQuery-TreeViewJS/我正在使用此插件。

  

$ okr_assigned_data =“选择不同的uu.division作为分区   确定内部联接目标o ok.id = o.okr_id内部联接用户u   on u.id = o.created_by sc.id = o.status上的内部联接status_conf sc   和o.is_deleted = 0和o.created_by ='$ loggined_user_id'内连接   用户uu on ok.user_id = uu.id where('$ start'之间的ok.start_date   和'$ end')按照u.status asc“;

的uu.id顺序分组
$assign_result = mysql_query($okr_assigned_data,$link);
if(mysql_num_rows($assign_result) > 0){
echo '<div class="treeview-container">
  <ul class="treeview">
       <li class="contains-items"> '.$qperiod_search.'';
    while($row = mysql_fetch_array($assign_result))
    {
        echo '<ul style="display: none;">
        <li class="contains-items items-expanded" id="'.$row[division].'">'.$row[division].'
             <ul style="display: block;" class="'.$row[division].'">
            <li class="contains-items items-expanded">'.$row[names].' <ul>
            <li><div class="obj_list" id=objective_'.$row['objective_id'].' onclick=created_objective_click(this.id)>
 <h3>'. substr($row['ObjectiveName'],0,50 ).'...</h3><p class="status_icon">';?>
<?php 
if($row['status']=='open'){
    echo "<i class='fa fa-folder-open openstatus' aria-hidden='true'></i>".$row['status'];
}
else if($row['status']=='in progress'){
    echo "<i class='fa fa-refresh progress_status' aria-hidden='true'></i>".$row['status'];
}
else if($row['status']=='completed'){
    echo "<i class='fa fa-check completedstatus' aria-hidden='true'></i>".$row['status'];
}
 echo "</p>
 <p class='list_cal'><i class='fa fa-calendar' aria-hidden='true'></i>".date("d-M-Y", strtotime($row['start_date']))." To ".date("d-M-Y", strtotime($row['end_date']))."</p></div>";
?>
<?php echo 
 '</li>
         </ul></li>

          </ul>
        </li>
      </ul> ';
        }
    echo ' </li>
  </ul>
</div>';
}
    else{

    }

0 个答案:

没有答案