#! /usr/bin/php
<?php
/**
- * Class Generator for Gforge
+ * Class Generator for FusionForge
*
* Copyright 2005 (c) Francisco Gimeno
*
- * This file is part of FusionForge.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require ('squal_pre.php');
/* In the future, we should be able to read this from a file */
$input = "<?php\n".
"/**\n".
- " * Gforge %{CLASS_NAME} Facility\n".
+ " * FusionForge %{CLASS_NAME} Facility\n".
" *\n".
- " * Copyright %{YEAR} (c) %{AUTHOR}\n".
+ " * Copyright (c) %{YEAR} %{AUTHOR}\n".
" *\n".
- " * This file is part of %{PROJECT}.\n".
+ " * This file is part of FusionForge. FusionForge is free software;\n".
+ " * you can redistribute it and/or modify it under the terms of the\n".
+ " * GNU General Public License as published by the Free Software\n".
+ " * Foundation; either version 2 of the Licence, or (at your option)\n".
+ " * any later version.\n".
" *\n".
+ " * FusionForge is distributed in the hope that it will be useful,\n".
+ " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n".
+ " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n".
+ " * GNU General Public License for more details.\n".
" *\n".
- " * %{PROJECT} is free software: you can redistribute it and/or modify\n".
- " * it under the terms of the GNU General Public License as published by\n".
- " * the Free Software Foundation; either version 2 of the License, or\n".
- " * (at your option) any later version.\n".
- " *\n".
- " * %{PROJECT} distributed in the hope that it will be useful,\n".
- " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n".
- " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n".
- " * GNU General Public License for more details.\n".
- " *\n".
- " * You should have received a copy of the GNU General Public License\n".
- " * along with %{PROJECT}; if not, write to the Free Software\n".
- " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US\n".
+ " * You should have received a copy of the GNU General Public License along\n".
+ " * with FusionForge; if not, write to the Free Software Foundation, Inc.,\n".
+ " * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n".
" */\n".
- "/*\n\n\n\t%{TITLE}\n\tBy %{AUTHOR}, %{YEAR}\n\n\tRewrite in OO and coding ".
- "guidelines 12/2002 by Tim Perdue\n\n\n*/\n".
+ "\n".
+ "/**\n".
+ " * %{TITLE}\n".
+ " * By %{AUTHOR}, %{YEAR}\n".
+ " * Rewrite in OO and coding guidelines 12/2002 by Tim Perdue\n".
+ " */\n".
+ "\n".
"require_once('common/include/Error.class');\n";
"require_once('common/include/Validator.class');\n\n";
"\t\treturn true;\n";
$variables=array("%{ID_FIELD}","KKKK");
$substitutions=array(getIdFieldFromFieldsArr($fields),"FFFF");
-
+
$output.=str_replace($variables,$substitutions,$input);
$output.="\t}\n\n";
return $output;
if($count++ != 0)
$output.=","; // First occurence hasn't a comma before
$lineLength += strlen($fieldName );
- if ($lineLength >= 80 ) {
- $output.="\n\t\t"; // New line at 80
+ if ($lineLength >= 80 ) {
+ $output.="\n\t\t"; // New line at 80
$lineLength= 8;
}
$output.="\$".$fieldName;
$all_values.=",";
}
$field_len += strlen($fieldName);
- if ($field_len > 80) {
+ if ($field_len > 80) {
$all_fields.="\n\t\t\t\t\t";
$field_len = 40;
}
"\tfunction getID() {\n".
"\t\treturn \$this->data_array['".getIdFieldFromFieldsArr($fields)."'];\n".
"\t}\n\n";
-
+
return $output;
}
$type="string"; // TO DO: Check the Field
$variables = array("%{FUNCTION_NAME}","%{FIELD}","%{TYPE}");
$substitutions= array($functionName, $fieldName, $field["type"] );
- $output = str_replace($variables, $substitutions, $input );
-
+ $output = str_replace($variables, $substitutions, $input );
+
return $output;
}
$output.=","; // First occurence hasn't a comma before
$lineLength += strlen($fieldName );
if ($lineLength >= 80 ) {
- $output.="\n\t\t"; // New line at 80
+ $output.="\n\t\t"; // New line at 80
$lineLength= 8;
}
$output.="\$".$fieldName;
$this->setPermissionDeniedError();
return false;
} else {
- $res=db_query("DELETE FROM '.$tableName.' WHERE
+ $res=db_query("DELETE FROM '.$tableName.' WHERE
'.getIdFieldFromFieldsArr($fields).'=\'".$this->getID()."\'");
if (!$res || db_affected_rows($res) < 1) {
$this->setError(\'Could Not Delete: \'.db_error());