Exemple #1
0
             echo $notice;
             echo '<div class="list">
     <span class="bull">&bull;</span>Cột: <strong class="name_columns_edit">' . $columns . '</strong><hr/>
     <form action="database_table.php?action=edit_columns&name=' . $name . DATABASE_NAME_PARAMATER_1 . '&columns=' . $columns . '" method="post">
         <span class="bull">&bull;</span>Tên cột:<br/>
         <input type="text" name="column" value="' . stripslashes($column) . '" size="18"/><br/>
         <span class="bull">&bull;</span>Giá trị mặc định:<br/>
         <input type="text" name="default" value="' . stripslashes($default) . '" size="18"/><br/>
         <span class="bull">&bull;</span>Đội dài:<br/>
         <input type="text" name="length" value="' . stripslashes($length) . '" size="18"/><br/>
         <span class="bull">&bull;</span>Loại dữ liệu:<br/>
         <select name="type">' . printDataType(stripslashes($type)) . '</select><br/>
         <span class="bull">&bull;</span>Mã hóa - Đối chiếu:<br/>
         <select name="collection">' . printCollection(stripslashes($collection)) . '</select><br/>
         <span class="bull">&bull;</span>Thuộc tính:<br/>
         <select name="attributes">' . printAttributes(stripslashes($attributes)) . '</select><br/>
         <span class="bull">&bull;</span>Thêm:<br/>
         <input type="checkbox" name="is_null" value="1"' . ($is_null ? ' checked="checked"' : null) . '/>Null<br/>
         <input type="checkbox" name="auto_increment" value="1"' . ($auto_increment ? ' checked="checked"' : null) . '/>Tự tăng giá trị<hr/>
         <input type="submit" name="submit" value="Lưu"/>
         <a href="database_table.php?action=delete_columns' . DATABASE_NAME_PARAMATER_1 . '&name=' . $name . '&columns=' . $columns . '" id="href_delete_columns">Xóa</a>
     </form>
 </div>';
         } else {
             echo '<div class="title"><div class="ellipsis">' . $title . '</div></div>
 <div class="list">Tên cột không tồn tại</div>';
         }
     } else {
         if (isset($_GET['action']) && trim($_GET['action']) == 'delete_columns') {
             $info = null;
             $title = 'Sửa cột: ' . DATABASE_NAME . ' > ' . $name;
function printAccessorsAndMutators(&$bag, &$needsContents, &$indent)
{
    global $_globals;
    global $meta;
    $content_type = $bag['content_type'];
    $pre = '';
    getTypeNameAndPrefix($content_type, $pre);
    if ($_globals['accessorsAndMutators'] && ($bag['useXMLNS'] || count($bag['attributes']) > 0 || count($bag['elements']) > 0 || ($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract'])) {
        //generate accessors and mutators for everything
        print "\n" . $indent . "public:\t//Accessors and Mutators\n";
        if ($bag['isExtension']) {
            printAttributes($meta[$bag['base_type']], $typemeta, $indent, !$meta[$bag['base_type']]['isAComplexType']);
        }
        printAttributes($bag, $typemeta, $indent, !$bag['isAComplexType']);
        for ($i = 0; $i < count($bag['elements']); $i++) {
            $maxOccurs = $bag['element_attrs'][$bag['elements'][$i]]['maxOccurs'];
            $maxOccurs = $maxOccurs == 'unbounded' || $maxOccurs > 1;
            $type = '';
            if (isset($bag['element_attrs'][$bag['elements'][$i]]['type']) && isset($meta[$bag['element_attrs'][$bag['elements'][$i]]['type']])) {
                $type = $_globals['prefix'] . ucfirst($bag['element_attrs'][$bag['elements'][$i]]['type']) . ($maxOccurs ? "_Array" : "Ref");
            } else {
                $type = $_globals['prefix'] . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_Array" : "Ref");
            }
            $name = ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "");
            if ($maxOccurs) {
                //comment
                print $indent . "\t/**\n" . $indent . "\t * Gets the " . $bag['elements'][$i] . " element array.\n";
                print $indent . "\t * @return Returns a reference to the array of " . $bag['elements'][$i] . " elements.\n";
                print $indent . "\t */\n";
                //code
                print $indent . "\t" . $type . " &get" . $name . "() { return elem" . $name . "; }\n";
                //comment
                print $indent . "\t/**\n" . $indent . "\t * Gets the " . $bag['elements'][$i] . " element array.\n";
                print $indent . "\t * @return Returns a constant reference to the array of " . $bag['elements'][$i] . " elements.\n";
                print $indent . "\t */\n";
                //code
                print $indent . "\tconst " . $type . " &get" . $name . "() const { return elem" . $name . "; }\n";
                //print $indent ."\tvoid set". $name ."( ". $type ." *e". $name ." ) { elem". $name ." = *e". $name ."; }\n\n";
            } else {
                //comment
                print $indent . "\t/**\n" . $indent . "\t * Gets the " . $bag['elements'][$i] . " element.\n";
                print $indent . "\t * @return a daeSmartRef to the " . $bag['elements'][$i] . " element.\n";
                print $indent . "\t */\n";
                //code
                print $indent . "\tconst " . $type . " get" . $name . "() const { return elem" . $name . "; }\n";
                //print $indent ."\tvoid set". $name ."( ". $type ." &e". $name ." ) { elem". $name ." = e". $name ."; }\n\n";
            }
            if (isset($meta[$bag['elements'][$i]])) {
                if (count($meta[$bag['elements'][$i]]['substitutableWith']) > 0) {
                    $needsContents = true;
                }
            }
        }
        if ($bag['hasChoice'] || $needsContents || $bag['has_any']) {
            //comment
            print $indent . "\t/**\n" . $indent . "\t * Gets the _contents array.\n";
            print $indent . "\t * @return Returns a reference to the _contents element array.\n";
            print $indent . "\t */\n";
            //code
            print $indent . "\tdaeElementRefArray &getContents() { return _contents; }\n";
            //comment
            print $indent . "\t/**\n" . $indent . "\t * Gets the _contents array.\n";
            print $indent . "\t * @return Returns a constant reference to the _contents element array.\n";
            print $indent . "\t */\n";
            //code
            print $indent . "\tconst daeElementRefArray &getContents() const { return _contents; }\n\n";
        }
        if (($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract']) {
            $type = $content_type;
            if ($meta[$content_type]['isAComplexType']) {
                $type = $type . "Ref";
            }
            $baseStringTypes = "xsDateTime xsID xsNCName xsNMTOKEN xsName xsToken xsString domSidref domSid";
            $baseType = $pre . ucfirst($type);
            if (isset($typemeta[$type])) {
                $typeInfo = $typemeta[$type];
                while ($typeInfo['base'] != '' && isset($typemeta[$typeInfo['base']])) {
                    $typeInfo = $typemeta[$typeInfo['base']];
                    if (preg_match("/xs\\:/", $typeInfo['type'])) {
                        $baseType = "xs" . ucfirst(substr($typeInfo['type'], 3));
                    } else {
                        $baseType = $_globals['prefix'] . ucfirst($typeInfo['type']);
                    }
                }
            }
            //if ( !strcmp( $pre . ucfirst( $type ), $full_element_name ) ) {
            if ($bag['parent_meta']['inline_elements'] != NULL && array_key_exists($type, $bag['parent_meta']['inline_elements'])) {
                $pre = '::' . $pre;
            }
            if (!isset($bag['baseTypeViaRestriction'])) {
                if (isset($typemeta[$content_type]) && $typemeta[$content_type]['isArray'] || $content_type == 'IDREFS') {
                    //comment
                    print $indent . "\t/**\n" . $indent . "\t * Gets the _value array.\n";
                    print $indent . "\t * @return Returns a " . $pre . ucfirst($type) . " reference of the _value array.\n";
                    print $indent . "\t */\n";
                    //code
                    print $indent . "\t" . $pre . ucfirst($type) . " &getValue() { return _value; }\n";
                    //comment
                    print $indent . "\t/**\n" . $indent . "\t * Gets the _value array.\n";
                    print $indent . "\t * @return Returns a constant " . $pre . ucfirst($type) . " reference of the _value array.\n";
                    print $indent . "\t */\n";
                    //code
                    print $indent . "\tconst " . $pre . ucfirst($type) . " &getValue() const { return _value; }\n";
                    //comment
                    print $indent . "\t/**\n" . $indent . "\t * Sets the _value array.\n";
                    print $indent . "\t * @param val The new value for the _value array.\n";
                    print $indent . "\t */\n";
                    //code
                    print $indent . "\tvoid setValue( const " . $pre . ucfirst($type) . " &val ) { _value = val; }\n\n";
                    //print $indent ."\t _meta->getValueAttribute()->setIsValid(true); }\n\n";
                } else {
                    if (ucfirst($type) == 'AnyURI') {
                        //comment
                        print $indent . "\t/**\n" . $indent . "\t * Gets the value of this element.\n";
                        print $indent . "\t * @return Returns a " . $pre . ucfirst($type) . " of the value.\n";
                        print $indent . "\t */\n";
                        //code
                        print $indent . "\t" . $pre . ucfirst($type) . " &getValue() { return _value; }\n";
                        //comment
                        print $indent . "\t/**\n" . $indent . "\t * Gets the value of this element.\n";
                        print $indent . "\t * @return Returns a constant " . $pre . ucfirst($type) . " of the value.\n";
                        print $indent . "\t */\n";
                        //code
                        print $indent . "\tconst " . $pre . ucfirst($type) . " &getValue() const { return _value; }\n";
                        //comment
                        print $indent . "\t/**\n" . $indent . "\t * Sets the _value of this element.\n";
                        print $indent . "\t * @param val The new value for this element.\n";
                        print $indent . "\t */\n";
                        //code
                        print $indent . "\tvoid setValue( const " . $pre . ucfirst($type) . " &val ) { _value = val; }\n";
                        // We add a setter that takes a plain string to help with backward compatibility
                        //comment
                        print $indent . "\t/**\n" . $indent . "\t * Sets the _value of this element.\n";
                        print $indent . "\t * @param val The new value for this element.\n";
                        print $indent . "\t */\n";
                        //code
                        print $indent . "\tvoid setValue( xsString val ) { _value = val; }\n\n";
                    } else {
                        if (ucfirst($type) == 'IDREF') {
                            //comment
                            print $indent . "\t/**\n" . $indent . "\t * Gets the value of this element.\n";
                            print $indent . "\t * @return Returns a " . $pre . ucfirst($type) . " of the value.\n";
                            print $indent . "\t */\n";
                            //code
                            print $indent . "\t" . $pre . ucfirst($type) . " &getValue() { return _value; }\n";
                            //comment
                            print $indent . "\t/**\n" . $indent . "\t * Gets the value of this element.\n";
                            print $indent . "\t * @return Returns a constant " . $pre . ucfirst($type) . " of the value.\n";
                            print $indent . "\t */\n";
                            //code
                            print $indent . "\tconst " . $pre . ucfirst($type) . " &getValue() const { return _value; }\n";
                            //comment
                            print $indent . "\t/**\n" . $indent . "\t * Sets the _value of this element.\n";
                            print $indent . "\t * @param val The new value for this element.\n";
                            print $indent . "\t */\n";
                            //code
                            print $indent . "\tvoid setValue( const " . $pre . ucfirst($type) . " &val ) { _value = val; }\n\n";
                            //print $indent ."\t _meta->getValueAttribute()->setIsValid(true); }\n\n";
                        } else {
                            if (strstr($baseStringTypes, $baseType) !== FALSE && count($typemeta[$type]['enum']) == 0) {
                                //comment
                                print $indent . "\t/**\n" . $indent . "\t * Gets the value of this element.\n";
                                print $indent . "\t * @return Returns a " . $pre . ucfirst($type) . " of the value.\n";
                                print $indent . "\t */\n";
                                //code
                                print $indent . "\t" . $pre . ucfirst($type) . " getValue() const { return _value; }\n";
                                //comment
                                print $indent . "\t/**\n" . $indent . "\t * Sets the _value of this element.\n";
                                print $indent . "\t * @param val The new value for this element.\n";
                                print $indent . "\t */\n";
                                //code
                                print $indent . "\tvoid setValue( " . $pre . ucfirst($type) . " val ) { *(daeStringRef*)&_value = val; }\n\n";
                            } else {
                                //comment
                                print $indent . "\t/**\n" . $indent . "\t * Gets the value of this element.\n";
                                print $indent . "\t * @return a " . $pre . ucfirst($type) . " of the value.\n";
                                print $indent . "\t */\n";
                                //code
                                print $indent . "\t" . $pre . ucfirst($type) . "& getValue() { return _value; }\n";
                                //comment
                                print $indent . "\t/**\n" . $indent . "\t * Sets the _value of this element.\n";
                                print $indent . "\t * @param val The new value for this element.\n";
                                print $indent . "\t */\n";
                                //code
                                print $indent . "\tvoid setValue( const " . $pre . ucfirst($type) . "& val ) { _value = val; }\n\n";
                                //print $indent ."\t _meta->getValueAttribute()->setIsValid(true); }\n\n";
                            }
                        }
                    }
                }
            }
        }
    }
}
}
//CONSTRUCTORS
if (!$bag['isAComplexType']) {
    printConstructors($full_element_name, $bag, $baseClasses, $indent);
} else {
    printConstructors($full_element_name . "_complexType", $bag, $baseClasses, $indent);
    print $indent . "};\n\n";
    print $indent . "/**\n" . $indent . " * An element of type " . $full_element_name . "_complexType.\n" . $indent . " */\n";
    print $indent . "class " . $full_element_name . " : public daeElement, public " . $full_element_name . "_complexType\n";
    print $indent . "{\n";
    print $indent . "public:\n";
    print $indent . "\tvirtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::" . strtoupper($bag['element_name']) . "; }\n";
    print $indent . "\tstatic daeInt ID() { return " . $_globals['typeID']++ . "; }\n";
    print $indent . "\tvirtual daeInt typeID() const { return ID(); }\n";
    if ($_globals['accessorsAndMutators'] && ($bag['useXMLNS'] || count($bag['attributes']) > 0)) {
        //generate accessors and mutators for everything
        print "\n" . $indent . "public:\t//Accessors and Mutators\n";
        printAttributes($bag, $typemeta, $indent, true);
    }
    $dummy = array();
    printConstructors($full_element_name, $dummy, array("daeElement", $full_element_name . "_complexType"), $indent);
}
print "\n" . $indent . "public: // STATIC METHODS\n";
print $indent . "\t/**\n" . $indent . "\t * Creates an instance of this class and returns a daeElementRef referencing it.\n";
print $indent . "\t * @return a daeElementRef referencing an instance of this object.\n" . $indent . "\t */\n";
print $indent . "\tstatic DLLSPEC " . $_globals['meta_prefix'] . "ElementRef create(DAE& dae);\n";
print $indent . "\t/**\n" . $indent . "\t * Creates a daeMetaElement object that describes this element in the meta object reflection framework.";
print "\n" . $indent . "\t * If a daeMetaElement already exists it will return that instead of creating a new one. \n";
print $indent . "\t * @return A daeMetaElement describing this COLLADA element.\n" . $indent . "\t */\n";
print $indent . "\tstatic DLLSPEC " . $_globals['meta_prefix'] . "MetaElement* registerElement(DAE& dae);\n";
print $indent . "};\n\n";