Skip to content
Snippets Groups Projects
Commit d2ec0c08 authored by Giovannoni Laurent's avatar Giovannoni Laurent
Browse files

MVC Actions

parent 5230a32d
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ class ActionControler
* Actions table
*/
public static $actions_table ;
/**
* Actions_groupbaskets_table table
*/
......@@ -76,6 +76,7 @@ class ActionControler
$db = new dbquery();
$db->connect();
self::$actions_table = $_SESSION['tablename']['actions'];
self::$actions_groupbaskets_table = $_SESSION['tablename']['bask_actions_groupbaskets'];
self::$db=$db;
}
......@@ -96,8 +97,10 @@ class ActionControler
*/
public function get($action_id)
{
if(empty($action_id))
if(empty($action_id)) {
return null;
}
self::connect();
$query = "select * from ".self::$actions_table." where id = ".$action_id;
......@@ -136,14 +139,18 @@ class ActionControler
*/
public function save($action, $mode)
{
if(!isset($action) )
if(!isset($action)) {
return false;
if($mode == "up")
return self::update($action);
elseif($mode =="add")
}
if($mode == "up") {
//return self::update($action);
self::update($action);
return 'WTF !!!';
}
elseif($mode =="add"){
return self::insert($action);
}
return false;
}
......@@ -260,7 +267,7 @@ class ActionControler
$ok = false;
}
self::disconnect();
//self::disconnect();
return $ok;
}
......
......@@ -386,4 +386,35 @@ class Maarch_Core_Class_StatusControler
self::$db->disconnect();
return false;
}
}
\ No newline at end of file
/**
* Return all status infos
* @return array of stauts
*/
public function getAllInfos() {
$db = new dbquery();
$db->connect();
$query = "select * from " . STATUS_TABLE . " ";
try {
if ($_ENV['DEBUG'])
echo $query . ' // ';
$db->query($query);
} catch (Exception $e) {
echo _NO_STATUS . ' // ';
}
if ($db->nb_result() > 0) {
$result = array ();
$cptId = 0;
while ($queryResult = $db->fetch_object()) {
$result[$cptId]['id'] = $queryResult->id;
$result[$cptId]['label'] = $queryResult->label_status;
$cptId++;
}
$db->disconnect();
return $result;
} else {
$db->disconnect();
return null;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment