public function addName($nameObj) { echo "Add name"; $name = new Name(); $name->CreationDate = $nameObj["CreationDate"]; $name->Exclude = $nameObj["Exclude"]; $name->Name = $nameObj["Name"]; $name->Vote = $nameObj["Vote"]; $name->UserCreator = $nameObj["UserCreator"]; $name->Email = $nameObj["Email"]; $name->save(); return $name->id; }
public function post(NameRequest $request) { $name = new Name(); $name->name = input::get('name'); $name->email = input::get('email'); $name->image = input::file('image')->getClientOriginalName(); $name->created_at = date("y-m-d h:i:s"); $name->save(); return Redirect::to('name'); if (Input::hasFile('image')) { $file = Input::file('image'); $file->move(storage_path() . '/uploads', $file->getClientOriginalName()); } else { return Redirect::to('name'); } }
public function editElementProcces() { if (!$this->session->userdata('logged_in')) { redirect('user/login'); } print "<pre>"; print_r($_POST); print "</pre>"; $element_id = $_POST['element_id']; // change main name $element = new SimpleElement($this->oh, $element_id); $element->main_name = $_POST['main_name']; $element->save(); print_query($this->db); unset($_POST['main_name']); //new name and season if ($_POST['newName']) { $season = -1; if ($_POST['newNameSeason'] && $_POST['newNameSeason'] != -1) { $season = $_POST['newNameSeason']; } $newSeason = new Season($this->db); $newSeason->element_id = $element_id; $newSeason->season = $season; $newSeason->save(); $newName = new Name($this->db); $newName->element_id = $element_id; $newName->name = $_POST['newName']; $newName->season = $newSeason; $newName->save(); unset($_POST['newName']); unset($_POST['newNameSeason']); } foreach ($_POST as $key => $value) { if (strpos($key, "elementLocationNew_") !== false) { $key = explode("_", $key); $location_id = $key[1]; $season = -1; if ($_POST["elementLocationSeasonNew_" . $location_id] && $_POST["elementLocationSeasonNew_" . $location_id] != "all") { $season = $_POST["elementLocationSeasonNew_" . $location_id]; } $seasonSize = -1; if ($_POST["elementLocationSeasonNew_" . $location_id] && $_POST["elementLocationSeasonNew_" . $location_id] != "infinite") { $seasonSize = $_POST["elementLocationSeasonNew_" . $location_id]; } $newSeason = new Season($this->db); $newSeason->element_id = $element_id; $newSeason->season = $season; $newSeason->save(); $newElementLocation = new ElementLocation($this->db); $newElementLocation->location = new Location($this->db, $location_id); $newElementLocation->element = new Element($this->db, $element_id); $newElementLocation->season = $newSeason; $newElementLocation->identifier = $value; $newElementLocation->seasonsize = $seasonSize; $newElementLocation->save(); unset($_POST[$key]); unset($_POST["elementLocationSeasonNew_" . $location_id]); continue; } if (strpos($key, "location_") !== false) { print "----------------<br>"; $key = explode("_", $key); $elementLocation_id = $key[1]; $oldSeason = $key[2]; if ($value || $_POST["locationSize_" . $elementLocation_id] && $_POST["locationSeason_" . $elementLocation_id]) { $season = -1; if ($_POST["locationSeason_" . $elementLocation_id] && $_POST["locationSeason_" . $elementLocation_id] != "all") { $season = $_POST["locationSeason_" . $elementLocation_id]; } $seasonSize = -1; if ($_POST["locationSize_" . $elementLocation_id] && $_POST["locationSize_" . $elementLocation_id] != "infinite") { $seasonSize = $_POST["locationSize_" . $elementLocation_id]; } $newSeason = new Season($this->db); $newSeason->element_id = $element_id; $newSeason->season = $season; $newSeason->save(); $newElementLocation = new ElementLocation($this->db, $elementLocation_id); print $newElementLocation->location->name . ": " . $newElementLocation->identifier . "<br>"; $newElementLocation->season = $newSeason; $newElementLocation->identifier = $value; $newElementLocation->seasonsize = $seasonSize; $newElementLocation->save(); } else { $newElementLocation = new ElementLocation($this->db, $elementLocation_id); $newElementLocation->delete(); } continue; } if (strpos($key, "name_") !== false) { print "----------------<br>"; $key = explode("_", $key); $name_id = $key[1]; if ($value) { $season = -1; if ($_POST["nameSeason_" . $name_id] && $_POST["nameSeason_" . $name_id] != "all") { $season = $_POST["nameSeason_" . $name_id]; } $newSeason = new Season($this->db); $newSeason->element_id = $element_id; $newSeason->season = $season; $newSeason->save(); $newName = new Name($this->db, $name_id); $newName->name = $value; $newName->season = $newSeason; $newName->save(); } else { $newName = new Name($this->db, $name_id); $newName->delete(); } continue; } } if (!isset($_POST['debug'])) { redirect('xem/editElement/' . $element_id); } }
function saveAltenativeName() { if (!$this->session->userdata('logged_in')) { $this->_fullOut('failure', array(), "not loged in"); return false; } $name = new Name($this->oh, $_POST['name_id']); $name->name = $_POST['name']; $name->save(); $this->_fullOut('success', $_POST); }