Bonjour,
j'ai ce message d'erreur lorsque je veux me connecter sur mon application:
"invalid argument supplied for foreach() in c:\program files\EasyPHP 2.0b1\www\bytesys\applications\bo\objects\p4a_base_application.php on line 40"
et voici le code:
<?php
class P4A_Base_Application extends p4a
{
var $user_data = array();
function P4A_Base_Application()
{
$this->p4a();
$this->openMask("p4a_login");
$access_levels =& $this->build("p4a_array_source","access_levels");
$a = array();
for($i=1;$i<=10;$i++) {
$a[]["value"] = $i;
}
$access_levels->load($a);
$access_levels->setPk("value");
}
function createMenu()
{
if ( isset($this->menu) AND is_object($this->menu)) {
$this->menu->destroy();
}
$menu =& $this->build("p4a_menu","menu");
$db =& P4A_DB::singleton();
// livello menu 1
$items1 = $db->queryAll("SELECT * FROM menu_bo
WHERE parent_id IS NULL
ORDER BY position, name
");
***** foreach ($items1 as $item) {
$parent_name = $item["name"];
$name = $item["name"];
$label = $item["label"];
$id = $item["id"];
$item_obj =& $menu->addItem($name);
$item_obj->setLabel($label);
if ($this->user_data['level'] < $item['access_level']
or $item['visible'] == FALSE) {
$item_obj->setVisible(FALSE);
}
if (strlen($item['action'])) {
$this->intercept($item_obj,'onClick',$item['action']);
}
// livello menu 2
$items2 = $db->queryAll("SELECT * FROM menu_bo
WHERE parent_id = ".$id."
ORDER BY position, name
");
foreach ($items2 as $item2) {
$parent_name2 = $item2["name"];
$name2 = $item2["name"];
$label2 = $item2["label"];
$id2 = $item2["id"];
$item_obj2 =& $menu->items->$parent_name->addItem($name2);
$item_obj2->setLabel($label2);
if ($this->user_data['level'] < $item2['access_level']
or $item2['visible'] == FALSE) {
$item_obj2->setVisible(FALSE);
}
if (strlen($item2['action'])) {
$this->intercept($item_obj2,'onClick',$item2['action']);
}
// livello menu 3
$items3 = $db->queryAll("SELECT * FROM menu_bo
WHERE parent_id = ".$id2."
ORDER BY position, name
");
foreach ($items3 as $item3) {
$parent_name3 = $item3["name"];
$name3 = $item3["name"];
$label3 = $item3["label"];
$id3 = $item3["id"];
$item_obj3 =& $menu->items->$parent_name->items->$parent_name2->addItem($name3);
$item_obj3->setLabel($label3);
if ($this->user_data['level'] < $item3['access_level']
or $item3['visible'] == FALSE) {
$item_obj3->setVisible(FALSE);
}
if (strlen($item3['action'])) {
$this->intercept($item_obj3,'onClick',$item3['action']);
}
// livello menu 4
$items4 = $db->queryAll("SELECT * FROM menu_bo
WHERE parent_id = ".$id3."
ORDER BY position, name
");
foreach ($items4 as $item4) {
$parent_name4 = $item4["name"];
$name4 = $item4["name"];
$label4 = $item4["label"];
$id4 = $item4["id"];
$item_obj4 =& $menu->items->$parent_name->items->$parent_name2->items->$parent_name3->addItem($name4);
$item_obj4->setLabel($label4);
if ($this->user_data['level'] < $item4['access_level']
or $item4['visible'] == FALSE) {
$item_obj4->setVisible(FALSE);
}
if (strlen($item4['action'])) {
$this->intercept($item_obj4,'onClick',$item4['action']);
}
// livello menu 5
$items5 = $db->queryAll("SELECT * FROM menu_bo
WHERE parent_id = ".$id4."
ORDER BY position, name
");
foreach ($items5 as $item5) {
$parent_name5 = $item5["name"];
$name5 = $item5["name"];
$label5 = $item5["label"];
$id5 = $item5["id"];
$item_obj5 =& $menu->items->$parent_name->items->$parent_name2->items->$parent_name3->items->$parent_name4->addItem($name5);
$item_obj5->setLabel($label5);
if ($this->user_data['level'] < $item5['access_level']
or $item5['visible'] == FALSE) {
$item_obj5->setVisible(FALSE);
}
if (strlen($item5['action'])) {
$this->intercept($item_obj5,'onClick',$item5['action']);
}
}
}
}
}
}
$menu->addItem("logout");
$this->intercept($menu->items->logout,"onClick","restart");
}
function openMask($name)
{
if (is_object($name)) {
parent::openMask($name->getName());
} else {
parent::openMask($name);
}
}
}
?>
Configuration: Windows XP
Firefox 3.0.3