コード例 #1
0
 /**
  * Get a flexible interface to view the children and parents of a given element
  * One can add parents and children to the hierarchy 
  *
  * @param string $user_prefix            A identifier provided by the
  *                                       programmer to recognise it's
  *                                       generated HTML form
  * @param string $graph_element          Hotspot_Graph_Element
  * @return string HTML markup
  */
 public static function getGraphAdminUI($user_prefix, $graph_element)
 {
     $db = AbstractDb::getObject();
     // Init values
     $html = "";
     $object_id = $db->escapeString($graph_element->getHgeId());
     // Get the parents
     if (!$graph_element->isRoot()) {
         $_title = _("Parents :");
         $parent_rows = HotspotGraph::getParents($object_id);
         $listData = "";
         if ($parent_rows) {
             foreach ($parent_rows as $parent_row) {
                 $classname = $parent_row['element_type'];
                 $element = HotspotGraphElement::getObject($parent_row['element_id'], $classname);
                 $parentStr = htmlspecialchars($parent_row['name']) . " (" . htmlspecialchars($parent_row['element_type']) . ")  ";
                 $name = $object_id . "_parent_" . $parent_row['next_element_id'] . "_remove";
                 $listDataContents = InterfaceElements::generateAdminSection("", $parentStr, InterfaceElements::generateInputSubmit($name, _("Remove from")));
                 $listData .= "<li class='admin_element_item_container node_owner_list'>" . $listDataContents . "</li>\n";
             }
         }
         $listData .= "<li class='admin_element_item_container'>";
         $listData .= HotspotGraphElement::getSelectGraphElementUI($object_id . "_parent_add_element", array('additionalWhere' => " AND element_type in ('Network', 'NodeGroup') AND hotspot_graph_element_id != '{$db->escapeString($graph_element->getHgeId())}'"));
         $listData .= InterfaceElements::generateInputSubmit($object_id . "_parent_add", _("Add"));
         $listData .= "<br class='clearbr' /></li>\n";
         $_data = "<ul id='node_owner_ul' class='admin_element_list'>\n" . $listData . "</ul>\n";
         $html .= InterfaceElements::generateAdminSectionContainer("element_parent", $_title, $_data);
     }
     // Get the children
     if (!$graph_element->isLeaf()) {
         $_title = _("Children :");
         $children_rows = HotspotGraph::getChildren($object_id);
         $listData = "";
         if ($children_rows) {
             foreach ($children_rows as $child_row) {
                 $classname = $child_row['element_type'];
                 $element = HotspotGraphElement::getObject($child_row['element_id'], $classname);
                 $childStr = htmlspecialchars($child_row['name']) . " (" . htmlspecialchars($child_row['element_type']) . ")  ";
                 $name = $object_id . "_child_" . $child_row['next_element_id'] . "_remove";
                 $listDataContents = InterfaceElements::generateAdminSection("", $childStr, InterfaceElements::generateInputSubmit($name, _("Remove from")));
                 $listData .= "<li class='admin_element_item_container node_owner_list'>" . $listDataContents . "</li>\n";
             }
         }
         $listData .= "<li class='admin_element_item_container'>";
         $listData .= HotspotGraphElement::getSelectGraphElementUI($object_id . "_child_add_element", array('additionalWhere' => " AND element_type in ('Node', 'NodeGroup') AND hotspot_graph_element_id != '{$db->escapeString($graph_element->getHgeId())}'"));
         $listData .= InterfaceElements::generateInputSubmit($object_id . "_child_add", _("Add"));
         $listData .= "<br class='clearbr' /></li>\n";
         $_data = "<ul id='node_owner_ul' class='admin_element_list'>\n" . $listData . "</ul>\n";
         $html .= InterfaceElements::generateAdminSectionContainer("element_children", $_title, $_data);
     }
     return $html;
 }
コード例 #2
0
ファイル: Network.php プロジェクト: cnlangzi/wifidog-auth
 /**
  * Get an instance of the object
  *
  * @param string $id The object id
  *
  * @return mixed The Content object, or null if there was an error
  *               (an exception is also thrown)
  *
  * @see GenericObject
  * @static
  * @access public
  */
 public static function &getObject($id)
 {
     return HotspotGraphElement::getObject($id, 'Network');
 }
コード例 #3
0
ファイル: NodeGroup.php プロジェクト: cnlangzi/wifidog-auth
 /** Instantiate a nodeGroup object
  * @param $id The id of the requested node group
  * @return a NodeGroup object, or null if there was an error
  */
 public static function &getObject($id)
 {
     return HotspotGraphElement::getObject($id, 'NodeGroup');
 }