Ejemplo n.º 1
0
function display_class(Class_Prog $class, TableCreator $table_creator)
{
    $txt = "";
    if (!$class->library) {
        $id = $class->full_name();
        $name = $class->full_name(" :: ");
        $txt .= $table_creator->anchor($id, '') . "\n";
        $txt .= $table_creator->title(4, $name, $class->name);
        $txt .= $table_creator->begin_desc_list();
        $txt .= $table_creator->desc_list_item('Descrizione', $class->description);
        if (strlen(trim($class->usage)) > 0) {
            $txt .= $table_creator->desc_list_item('Utilizzo', $class->usage);
        }
        $class->with('children', 'parents');
        if (count($class->parents)) {
            $inh_txt = '';
            $inh_txt .= "\\vspace{-7mm}\n";
            $inh_txt .= $table_creator->begin_list();
            foreach ($class->parents as $par) {
                if (!$par->library) {
                    $inh_txt .= $table_creator->list_item($table_creator->link($par->full_name(), $par->full_name(" :: ")));
                } else {
                    $inh_txt .= $table_creator->list_item($par->full_name());
                }
            }
            $inh_txt .= $table_creator->end_list();
            $txt .= $table_creator->desc_list_item('Classi ereditate', $inh_txt);
        }
        if (count($class->children)) {
            $inh_txt = '';
            $inh_txt .= "\\vspace{-7mm}\n";
            $inh_txt .= $table_creator->begin_list();
            foreach ($class->children as $par) {
                $inh_txt .= $table_creator->list_item($table_creator->link($par->full_name(), $par->full_name(" :: ")));
            }
            $inh_txt .= $table_creator->end_list();
            $txt .= $table_creator->desc_list_item('Classi figlie', $inh_txt);
        }
        $ass = Association::model()->findAll('class_from = :idc or class_to = :idc', array(':idc' => $class->id_class));
        if (count($ass)) {
            $rel = '';
            $rel .= "\\vspace{-7mm}\n";
            $rel .= $table_creator->begin_desc_list();
            foreach ($ass as $ss) {
                if ($ss->class_to != $class->id_class) {
                    $par = $ss->with('classTo')->classTo;
                    $ass_dir = "uscente";
                } else {
                    if ($ss->class_from != $class->id_class) {
                        $par = $ss->with('classFrom')->classFrom;
                        $ass_dir = "entrante";
                    } else {
                        continue;
                    }
                }
                $ss->with('attribute');
                if (!$par->library) {
                    $acn = $par->full_name();
                    if (strlen($acn) > 60) {
                        $acn = substr($acn, strlen($acn) - 60);
                        $acn = "..." . substr($acn, strpos($acn, "::") + 2);
                    }
                    $ass_name = $table_creator->link($par->full_name(), $acn);
                } else {
                    $ass_name = $par->full_name();
                }
                $ass_txt = "Relazione {$ass_dir}, " . lcfirst($ss->attribute->description);
                $rel .= $table_creator->desc_list_item($ass_name, $ass_txt);
            }
            $rel .= $table_creator->end_desc_list();
            $txt .= $table_creator->desc_list_item('Relazioni con altre classi', $rel);
        }
    }
    $txt .= $table_creator->end_desc_list();
    $txt .= "\n\\vspace{0.5cm}\n";
    return $txt;
}
Ejemplo n.º 2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadAssoc($id)
 {
     $model = Association::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 3
0
 function package(Package $package, $assoc)
 {
     $package->with('parent0, packages, classes');
     $id = $this->package_id($package->id_package);
     $namespace = $this->package_id($package->parent);
     $this->open_uml_simple_element('Namespace.ownedElement');
     $this->open_uml_element('Package', $id, $package->name, $namespace);
     $this->open_uml_simple_element('Namespace.ownedElement');
     foreach ($package->packages as $c) {
         $this->package($c, $assoc);
     }
     foreach ($package->classes as $c) {
         $this->print_class($c, $assoc);
     }
     if ($assoc) {
         $ass = Association::model()->findAll(array('join' => 'Join class c on c.id_class = class_from', 'condition' => 'id_package = :idp', 'params' => array('idp' => $package->id_package)));
         foreach ($ass as $hole) {
             $this->association($hole, $id);
         }
     }
     $sig = Connect::model()->findAll(array('join' => 'Join method sl on sl.id_method = t.slot
                        join class c on c.id_class = sl.id_class', 'condition' => 'c.id_package = :idp', 'params' => array('idp' => $package->id_package)));
     foreach ($sig as $segv) {
         $this->signal($segv, $id);
     }
     foreach ($package->packages as $child) {
         $dep = $child->get_dependencies(false);
         $child_id = $this->package_id($child->id_package);
         foreach ($dep as $d) {
             if ($d['id_from'] != $child->id_package) {
                 continue;
             }
             $did = $this->generic_id('UMLDependency');
             $dit = $this->package_id($d['id_to']);
             $this->open_uml_element('Dependency', "", $child_id, null, array('client' => $id, 'supplier' => $dit));
         }
     }
     $this->close_element();
     $this->close_element();
     $this->close_element();
 }