} if ($pos == "") { $pos = $_SESSION['page']; } $_SESSION['page'] = $pos; $a = new CategoryController($conn); $a->lang = $lang; $a->UserLevel = $UserLevel; $a->UserID = $UserID; $a->lang_str = $lang_str; switch ($action) { case "list": $a->browse($p, 20, $pos); break; case "add": $a->add(); break; case "edit": $a->edit($id); break; case "show": $a->show($id); break; case "save": $vars = $_POST; $vars['photo'] = $_FILES['photo']; //print_r($vars);return; $a->save($p, $vars); break; case "delete": $a->delete($id);
$row = explode('||', $line); if (count($row) == 5) { /* the data has valid number of elements, filter for any abnormalities in the data*/ $name = $row[0]; $name = str_replace("'", "''", $name); $address = $row[1]; $contacts = relinquishContacts($row[2]); $phone = $contacts[0]; $email = $contacts[1]; $website = $contacts[2]; $categoryLabel = $row[3]; $position = $row[4]; //create the category for the poi $category = new Category(); $category->init($parentController->getParentCategory($categoryLabel), $categoryLabel, $user); if ($id = $categoryController->add($category)) { $category->setId($id); //create the poi object $poi = new POI(); $poi->init($name, $address, $position, $category, $phone, $email, $website, "", $user); if ($poiController->add($poi)) { $insertCount++; } else { $skippedData[] = $line . "\n"; } } else { $skippedData[] = $line . "\n"; } } else { /* skip this data as it contains invalid number of data*/ $skippedData[] = $line . "\n";