This commit is contained in:
2023-04-14 20:52:27 +02:00
parent 84e2b419c8
commit 5b56197aaa
14 changed files with 102 additions and 73 deletions

View File

@@ -16,11 +16,17 @@ use Domframework\Dbjson;
*/
class DbjsonTest extends \PHPUnit_Framework_TestCase
{
private $DBFILE;
public function __construct()
{
$this->DBFILE = "/tmp/dbjson-" . time();
}
public function testInsertOne1()
{
// Document #0
define("dbfile", "/tmp/dbjson-" . time());
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->insertOne(
"collection",
["key1" => "val1", "key2" => "val2"]
@@ -31,7 +37,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testInsertOne2()
{
// Document #1
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->insertOne(
"collection",
["key1" => "val1", "key2" => "val2"]
@@ -43,7 +49,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
{
// Error : Invalid array provided (not array of array)
$this->setExpectedException("Exception");
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->insertMany(
"collection",
["key1" => "val1", "key2" => "val2"]
@@ -53,7 +59,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testInsertMany2()
{
// Document #2 and #3
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->insertMany(
"collection",
[["key1" => "val3", "key2" => "val2"],
@@ -65,21 +71,21 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testFilter1()
{
// Return all the keys (filter = array ())
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->filter("collection", []);
$this->assertSame(array_keys($res), [0,1,2,3]);
}
public function testFilter2()
{
// Return the keys where filter = array ("key2"=>"val2"))
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->filter("collection", ["key2" => "val2"]);
$this->assertSame(array_keys($res), [0,1,2]);
}
public function testFilter3()
{
// Return the keys where filter = array ("key1"=>"val3","key2"=>"val2"))
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->filter("collection", ["key1" => "val3",
"key2" => "val2"]);
$this->assertSame(count($res), 1);
@@ -88,7 +94,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
{
// Return the keys where filter = array ("key1"=>array ("val3", "=="),
// "key2"=>array ("val2", "=="))
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->filter("collection", ["key1" => ["val3", "=="],
"key2" => ["val2", "=="]]);
$this->assertSame(count($res), 1);
@@ -97,7 +103,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
{
// Return the keys where filter = array ("key1"=>array ("val3", "<="),
// "key2"=>array ("val2", "=="))
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->filter("collection", ["key1" => ["val3", "<="],
"key2" => ["val2", "=="]]);
$this->assertSame(array_keys($res), [0,1,2]);
@@ -106,7 +112,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
{
// Return the keys where filter = array ("key1"=>array ("val3", "<="),
// "key2"=>array ("val2", ">"))
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->filter("collection", ["key1" => ["val3", "<="],
"key2" => ["val2", ">"]]);
$this->assertSame(count($res), 1);
@@ -114,7 +120,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testFind1()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find("collection", ["key1" => ["val3", "<="],
"key2" => ["val2", ">"]]);
$res = array_values($res);
@@ -125,7 +131,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind2()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -142,7 +148,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
{
// Exception : fields not an array
$this->setExpectedException("Exception");
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -152,7 +158,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind4()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -166,7 +172,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind5()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -181,7 +187,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind6()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -202,7 +208,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind7()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -220,7 +226,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind8()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -236,7 +242,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testDeleteOne1()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->deleteOne(
"collection",
["key1" => ["val3", "<="],
@@ -247,7 +253,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind9()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -264,7 +270,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testDeleteMany1()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->deleteMany(
"collection",
["key1" => ["val3", "<="],
@@ -275,7 +281,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind10()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->find(
"collection",
["key1" => ["val3", "<="],
@@ -290,7 +296,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testFind11()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = array_values($dbjson->find("collection"));
// ["_id"] is random : skip the test
unset($res[0]["_id"]);
@@ -299,13 +305,13 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testReplace1()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->replace("collection", [], ["key2" => "val5"]);
$this->assertSame($res, 1);
}
public function testFind12()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = array_values($dbjson->find("collection"));
// ["_id"] is random : skip the test
unset($res[0]["_id"]);
@@ -314,14 +320,14 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testUpdate1()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->update("collection", [], ["key2" => "val6",
"key5" => "val5"]);
$this->assertSame($res, 1);
}
public function testFind13()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = array_values($dbjson->find("collection"));
// ["_id"] is random : skip the test
unset($res[0]["_id"]);
@@ -331,7 +337,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testInsertOne3()
{
// Document #4
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->insertOne(
"collection",
["key1" => "val1", "key2" => "val2"]
@@ -340,7 +346,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind14()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = array_values($dbjson->find("collection"));
// ["_id"] is random : skip the test
unset($res[0]["_id"]);
@@ -353,14 +359,14 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testUpdate2()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->update("collection", [], ["key2" => "val7",
"key5" => "val8"]);
$this->assertSame($res, 2);
}
public function testFind15()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = array_values($dbjson->find("collection"));
// ["_id"] is random : skip the test
unset($res[0]["_id"]);
@@ -374,7 +380,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
public function testUpdate3()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = $dbjson->update(
"collection",
[],
@@ -386,7 +392,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
}
public function testFind16()
{
$dbjson = new Dbjson("dbjson://" . dbfile);
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
$res = array_values($dbjson->find("collection"));
// ["_id"] is random : skip the test
unset($res[0]["_id"]);
@@ -399,8 +405,8 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
// Concurrency tests
public function testConcurrency1()
{
$dbjson1 = new Dbjson("dbjson://" . dbfile);
$dbjson2 = new Dbjson("dbjson://" . dbfile);
$dbjson1 = new Dbjson("dbjson://" . $this->DBFILE);
$dbjson2 = new Dbjson("dbjson://" . $this->DBFILE);
$dbjson1->insertOne(
"collection",
["key1" => "val1", "key2" => "val2"]

View File

@@ -214,7 +214,7 @@ class Authldap extends Auth
"email" => $vals["mail"][0]];
}
unset($data[$key]["mail"]["count"]);
unset($data[$key]["email"]["count"]);
}
return $data;

View File

@@ -490,10 +490,10 @@ class Authorizationdb extends Authorization
* Change mode bits for an object
* Need to be the owner of the object or the root administrator
* @param string $object Object path to change
* @param integer $mod Bits of authorization
* @param integer $modbits Bits of authorization
* @return boolean TRUE or an exception with the error message
*/
public function chmod($object, $mod)
public function chmod($object, $modbits)
{
if ($this->db === null) {
throw new \Exception(dgettext(
@@ -743,6 +743,7 @@ class Authorizationdb extends Authorization
foreach ($parents as $i => $p) {
$found = false;
$r = [];
foreach ($res as $r) {
if ($r["object"] === $p) {
$found = true;

View File

@@ -41,7 +41,7 @@ class Authshibboleth extends Auth
/**
* The optional URL to change the user password
*/
public $urlPasswd = "";
public $urlPasswdChange = "";
/**
* No connection to shibboleth

View File

@@ -91,6 +91,7 @@ class Cli
// This error code is not included in error_reporting
return;
}
$severity = "ERROR";
switch ($errno) {
case E_ERROR:
$severity = "ERROR";
@@ -217,6 +218,7 @@ class Cli
}
die("No controllers/models available in " . getcwd() . "\n");
}
$classes = [];
foreach ($files as $file) {
if (strpos($file, "_")) {
$classes[substr(strstr($file, "_"), 1, -4)] = $file;
@@ -415,17 +417,22 @@ class Cli
if (in_array("-?", $argv, true)) {
// Question mark display the PHPDoc of the method
$comment = "";
if (isset($r1)) {
$comment = trim(substr($r1->getDocComment(), 3, -2));
if ($comment !== "") {
$comment .= "\n";
}
}
$comment .= trim(substr($r2->getDocComment(), 3, -2));
$comment = preg_replace("#^\s*\*\s*#m", "", $comment);
$comment = preg_replace("#@param .+ \\$(\w+) #U", "<\\1> ", $comment);
$params = "";
if (isset($r1)) {
foreach ($r1->getParameters() as $param) {
$params .= "<" . $param->name . "> ";
}
}
foreach ($r2->getParameters() as $param) {
$params .= "<" . $param->name . "> ";
}
@@ -449,7 +456,7 @@ class Cli
// (Array management in CLI)
foreach ($argv as $key => $arg) {
// Don't modify the stdin
if (isset($keyStdIn) && $key === $keyStdIn) {
if ($key === $keyStdIn) {
continue;
}
$pairs = explode('&', $arg);

View File

@@ -694,7 +694,7 @@ class Console
*/
public function completeFunction($completionKeys, $completionFunction)
{
if (! is_string($completionKeys) && ! is_boolean($completionKeys)) {
if (! is_string($completionKeys) && ! is_bool($completionKeys)) {
$this->consoleException("Can not set the completionKeys : not a string");
}
if ($completionKeys === true) {

View File

@@ -351,12 +351,12 @@ class Dblayeroo
if ($this->sep === "") {
$this->DBException(dgettext("domframework", "Database not connected"));
}
$res = [];
switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME)) {
case "sqlite":
$req = "SELECT name FROM sqlite_master WHERE type='table'";
$st = self::$instance[$this->dsn]->prepare($req);
$st->execute();
$res = [];
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
if ($d["name"] !== "sqlite_sequence") {
$res[] = $d["name"];
@@ -369,7 +369,6 @@ class Dblayeroo
WHERE TABLE_SCHEMA='" . $this->databasename() . "'";
$st = self::$instance[$this->dsn]->prepare($req);
$st->execute();
$res = [];
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
$res[] = $d["TABLE_NAME"];
}
@@ -380,7 +379,6 @@ class Dblayeroo
WHERE schemaname = 'public'";
$st = self::$instance[$this->dsn]->prepare($req);
$st->execute();
$res = [];
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
$res[] = $d["tablename"];
}
@@ -430,6 +428,7 @@ class Dblayeroo
"No table name defined to create the table"
), 500);
}
$sql = "";
switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME)) {
case "sqlite":
$sql = "CREATE TABLE IF NOT EXISTS " .
@@ -1684,7 +1683,7 @@ class Dblayeroo
}
@list($func, $param) = explode("(", $realType);
$func = trim($func);
$method = "checkRealType_" . $func;
$method = "checkRealType" . ucfirst($func);
if (! method_exists($this, $method)) {
$this->DBException("Invalid setRealType provided : " .
"field '$field' : unknown realType provided '$func'");
@@ -2008,10 +2007,10 @@ class Dblayeroo
}
$display = $name = trim($display);
$pos = strpos($display, "(");
$separator = "";
if ($pos !== false) {
$func = strtoupper(trim(substr($name, 0, $pos)));
$name = trim(substr($name, $pos + 1, -1));
$separator = "";
if (
in_array($func, ["AVG", "COUNT", "GROUP_CONCAT", "MAX",
"MIN","SUM"], true)
@@ -2848,6 +2847,7 @@ class Dblayeroo
"The unique configuration is not an array"
));
}
$sql = "";
switch ($this->command) {
case "SELECT":
$sql = "SELECT";
@@ -2980,7 +2980,7 @@ class Dblayeroo
try {
$st = self::$instance[$this->dsn]->prepare($sql);
} catch (\Exception $e) {
$this->DBException($e->getMessage());
throw $this->DBException($e->getMessage());
}
}
foreach ($this->whereGetValues() as $hash => $val) {
@@ -3053,7 +3053,7 @@ class Dblayeroo
$text .= "(date)\n";
} else {
$text .= "(UNKNOWN)\n";
$this->DBException("TO BE DEVELOPPED : " . $fields[$field][0]);
$this->DBException("TO BE DEVELOPPED : Unknown type : " . $type);
}
if (!$textForm) {
if ($value === null) {
@@ -3306,6 +3306,7 @@ class Dblayeroo
}
$setValues = $values;
$foundImpactedLines = 0;
$resUpdate = [];
foreach ($uniques as $k => $columns) {
if ($update) {
// Can not update multiple UNIQUE rows with the same value
@@ -3314,7 +3315,7 @@ class Dblayeroo
} elseif (is_array($columns)) {
$cols = $columns;
} else {
$this->DBException(dgettext(
throw $this->DBException(dgettext(
"domframework",
"Unique def is not a string or an array"
));
@@ -3592,7 +3593,7 @@ class Dblayeroo
$val = trim($values[$field]);
@list($func, $param) = explode("(", $this->realTypes[$field]);
$func = trim($func);
$method = "checkRealType_" . $func;
$method = "checkRealType" . ucfirst($func);
$res = $this->$method($val, $this->realTypes[$field]);
if (is_string($res)) {
$errors[$field] = $res;
@@ -3796,7 +3797,7 @@ class Dblayeroo
break;
}
}
if ($autoInc !== null) {
if ($autoInc !== null && isset($col)) {
$autoInc = $this->table . "_{$col}_seq";
}
}
@@ -3912,7 +3913,7 @@ class Dblayeroo
* @param string $definition The definition of the type
* @return string or null
*/
private function checkRealType_integerPositive($val, $definition)
private function checkRealTypeIntegerPositive($val, $definition)
{
if (substr($val, 0, 1) === "-") {
return dgettext("domframework", "Invalid positive integer : " .
@@ -3935,7 +3936,7 @@ class Dblayeroo
* @param string $definition The definition of the type
* @return string or null
*/
private function checkRealType_integer($val, $definition)
private function checkRealTypeInteger($val, $definition)
{
if (strspn($val, "0123456789-") !== strlen($val)) {
return dgettext("domframework", "Invalid integer : " .
@@ -3959,7 +3960,7 @@ class Dblayeroo
* @param string $definition The definition of the type
* @return string or null
*/
private function checkRealType_allowedchars($val, $definition)
private function checkRealTypeAllowedchars($val, $definition)
{
list($func, $param) = explode("(", $definition);
if ($param === null) {
@@ -3988,7 +3989,7 @@ class Dblayeroo
* @param string $definition The definition of the type
* @return string or null
*/
private function checkRealType_array($val, $definition)
private function checkRealTypeArray($val, $definition)
{
list($func, $param) = explode("(", $definition);
if ($param === null) {
@@ -4018,7 +4019,7 @@ class Dblayeroo
* @param string $definition The definition of the type
* @return string or null
*/
private function checkRealType_regex($val, $definition)
private function checkRealTypeRegex($val, $definition)
{
list($func, $param) = explode("(", $definition);
if ($param === null) {
@@ -4047,7 +4048,7 @@ class Dblayeroo
* @param string $definition The definition of the type
* @return string or null
*/
private function checkRealType_mail($val, $definition)
private function checkRealTypeMail($val, $definition)
{
if (!! filter_var($val, FILTER_VALIDATE_EMAIL)) {
return;
@@ -4059,9 +4060,9 @@ class Dblayeroo
* Check the type "uuid"
* @param string $val The value to check
* @param string $definition The definition of the type
* @return string or null
* @return string|null
*/
private function checkRealType_uuid($val, $definition)
private function checkRealTypeUuid($val, $definition)
{
if (strlen($val) !== 36) {
return dgettext("domframework", "Invalid UUID provided : " .
@@ -4082,9 +4083,9 @@ class Dblayeroo
* Check the type "sqldate"
* @param string $val The value to check
* @param string $definition The definition of the type
* @return string or null
* @return string|null
*/
private function checkRealType_sqldate($val, $definition)
private function checkRealTypeSqldate($val, $definition)
{
if (strlen($val) !== 10) {
return dgettext("domframework", "Invalid date provided : " .
@@ -4117,9 +4118,9 @@ class Dblayeroo
* Check the type "sqltime"
* @param string $val The value to check
* @param string $definition The definition of the type
* @return string or null
* @return string|null
*/
private function checkRealType_sqltime($val, $definition)
private function checkRealTypeSqltime($val, $definition)
{
if (strlen($val) !== 8) {
return dgettext("domframework", "Invalid time provided : " .
@@ -4152,9 +4153,9 @@ class Dblayeroo
* Check the type "sqldatetime"
* @param string $val The value to check
* @param string $definition The definition of the type
* @return string or null
* @return string|null
*/
private function checkRealType_sqldatetime($val, $definition)
private function checkRealTypeSqldatetime($val, $definition)
{
if (strlen($val) !== 19) {
return dgettext("domframework", "Invalid date and time provided : " .

View File

@@ -691,6 +691,7 @@ class File
$newname = $this->realpath($newname);
$this->checkPathRO(dirname($oldname));
$this->checkPathRW(dirname($newname));
$rc = "";
if (is_dir($oldname)) {
// Copy directory structure
if (! $this->file_exists($newname)) {

View File

@@ -471,7 +471,8 @@ class Form
public function getToken()
{
if ($this->csrfToken === "") {
$this->createToken();
$csrf = new Csrf();
$this->csrfToken = $csrf->newToken();
}
return $this->csrfToken;
}

View File

@@ -87,6 +87,10 @@ class Formfield
* The Bootstrap width of the column of fields
*/
public $fieldwidth = 10;
/**
* Form template (Bootstrap3 by default)
*/
private $formTemplate = "Bootstrap3";
/**
* When adding a field, the name and the label are the minimum mandatory

View File

@@ -42,6 +42,12 @@ class Graph
*/
public $title = null;
/**
* The graph title position
* @var string
*/
private $titlePosition = null;
/**
* The height of the graph (150px by default)
*/

View File

@@ -73,6 +73,7 @@ class GraphAxisHorizontal extends GraphAxisGeneral
*/
public function positionMin($value)
{
$posCenter = $this->position($value);
if ($this->numerical) {
return $posCenter;
}

View File

@@ -137,6 +137,7 @@ class GraphAxisVertical extends GraphAxisGeneral
*/
public function positionMin($value)
{
$posCenter = $this->position($value);
if ($this->numerical) {
return $posCenter;
}

View File

@@ -268,7 +268,7 @@ class GraphSerie
"Invalid style provided to serie"
), 406);
}
$styleClass = "GraphStyle" . $style;
$styleClass = "GraphStyle" . ucfirst($style);
if ($this->style === null) {
$this->style = new $styleClass();
}