Exemple #1
0
/**
 *  Получить список VIEWS
 */
function dxray_get_views()
{
    $GML = new GraphML();
    $VIEWS = views_get_all_views();
    $nodeView = $GML->setOptionsNode()->Fill_setColor('#ccffff')->getOptions();
    $nodeDisplay = $GML->setOptionsNode()->Shape_setType('ellipse')->Fill_setColor('#ccffcc')->getOptions();
    $nodeDisplayPlug = $GML->setOptionsNode()->Shape_setType('parallelogram')->Fill_setColor('#33cccc')->getOptions();
    foreach ($VIEWS as $view) {
        //$id_view = $GML->addNodeShape($view->human_name);
        $v_data['attributes'] = array('Human name: ' . $view->human_name, 'Base_table: ' . $view->base_table, 'Base_field: ' . $view->base_field, 'Built: ' . dxray_convert_bool($view->built), 'Executed: ' . dxray_convert_bool($view->executed), 'Editing: ' . dxray_convert_bool($view->executed), 'Type: ' . $view->type);
        if ($view->attachment_before != '') {
            $v_data['attributes'][] = 'Attachment before: ' . $view->attachment_before;
            // string
        }
        if ($view->attachment_after != '') {
            $v_data['attributes'][] = 'Attachment after: ' . $view->attachment_after;
            // string
        }
        //$id_view = $GML->addNodeUMLClass($view->name, $v_data, $nodeView);
        $id_view = $GML->addNode($view->name, 'UMLClassNode', $nodeView, $v_data);
        $id_display = $GML->addNodeShape('Display', $nodeDisplay);
        $GML->addEdge($id_view, $id_display);
        $id_disp_plug_type = array();
        // name -> GML_ID
        foreach ($view->display as $display) {
            if (!isset($id_disp_plug_type[$display->display_plugin])) {
                $id_display_type = $GML->addNodeShape($display->display_plugin, $nodeDisplayPlug);
                $GML->addEdge($id_display, $id_display_type);
                $id_disp_plug_type[$display->display_plugin] = $id_display_type;
            } else {
                $id_display_type = $id_disp_plug_type[$display->display_plugin];
            }
            $data['attributes'] = array('ID: ' . $display->id, 'Display_Title: ' . $display->display_title, 'Display_plugin: ' . $display->display_plugin, 'DB table: ' . $display->db_table);
            if (isset($display->display_options['path'])) {
                $data['attributes'][] = 'Path: ' . $display->display_options['path'];
            }
            $id = $GML->addNodeUMLClass($display->display_title, $data);
            $GML->addEdge($id_display_type, $id);
        }
    }
    $dbg = 0;
    $file = DXRAY_OUTPATH . '/Views-' . date('d-m-Y_H-i-s') . '.graphml';
    $GML->createFullGraphML($file);
}