public function ProcceedToPayment() { include_once "models/FlightModel.php"; $flightId = Request::RequestParams("flightid"); $category = Request::RequestParams("ticketcategory"); $children = Request::RequestParams("children"); $adults = Request::RequestParams("adults"); $typeticket = Request::RequestParams("typeticket"); //set the booking details $booking = new BookInfo(); $booking->adult_no = isset($adults) ? $adults : 0; $booking->children_no = isset($children) ? $children : 0; $booking->flight_id = $flightId; $booking->ticket_cat = $category; $booking->ticket_type = $typeticket; $flightModel = new FlightModel(); $this->viewModel->flightDbModel = $flightModel; $this->viewModel->flight = $flightModel->GetFlightById($flightId); if ($booking->validated()) { if ($this->viewModel->flight != NULL) { $booking->ticket_adult_price = $this->viewModel->flight->ticketPrice; } } else { //else still required more informations $attr = new ArrayIterator(); $attr->offsetSet("class", "warning"); $attr->offsetSet("style", "border:1px solid #000;"); ContextManager::ValidationFor("warning", $booking->getError()); } $this->ViewBag("Title", "Booking"); $this->ViewBag("Controller", "Booking"); $this->ViewBag("Page", "Flight"); Session::set("BOOKINFO", $booking); return $this->View($this->viewModel, "Home", "Index"); }
public function hydrateResource() { $role = $this->role; $resources = $role->getResources(); foreach ($resources as $value) { $this->resources->offsetSet($value, $value); } return $this; }
public function offsetSet($key, $value) { if ((int) $value % 3 === 0 or (int) $value % 5 === 0) { parent::offsetSet($key, $value); } return; }
/** * Sets a collection entry * * @param string $index * @param string $content * * @throws \MarkdownExtended\Exception\UnexpectedValueException it the argument does not implement `\MarkdownExtended\API\ContentInterface` */ public function offsetSet($index, $content) { if (!is_object($content) || !Kernel::valid($content, Kernel::TYPE_CONTENT)) { throw new UnexpectedValueException(sprintf('Method "%s" expects the second parameter to implement "%s", got "%s"', __METHOD__, Kernel::CONTENT_INTERFACE, is_object($content) ? get_class($content) : gettype($content))); } parent::offsetSet($index, $content); }
/** * Set object * * @param mixed $index * @param Currency $newval */ public function offsetSet($index, $newval) { if (!$newval instanceof $this->currencyClass) { throw new \InvalidArgumentException(sprintf('$newval must be an instance of Currency, instance of "%s" given', get_class($newval))); } parent::offsetSet($index, $newval); }
/** */ public function offsetSet($offset, $value) { if (is_null($roffset = $this->_getRealOffset($offset))) { parent::offsetSet($offset, $value); } else { parent::offsetSet($roffset, $value); } }
public function collect(\Iterator $iterator) : \Traversable { $collection = new \ArrayIterator(); foreach ($iterator as $key => $value) { $collection->offsetSet($key, $value); } return $collection; }
/** * (PHP 5 >= 5.0.0)<br/> * Set value for an offset * * @link http://php.net/manual/en/arrayiterator.offsetset.php * * @param string $index <p> * The index to set for. * </p> * @param string $newval <p> * The new value to store at the index. * </p> * * @throws Exception\Collection When the collection has been marked as read-only * @throws Exception\Collection When the given type is not correct */ public function offsetSet($index, $newval) { if ($this->isReadOnly() === true) { throw Exception\Collection::readOnly(get_class($this)); } if ($this->isValidValue($newval) === false) { throw Exception\Collection::invalidType($newval, get_class($this)); } parent::offsetSet($index, $newval); }
/** * Reflect the handle class * * @param string $class * @return Collection\Method * @throws Exception\InvalidArgument */ public function reflect($class) { if (class_exists($class) === false) { throw new Exception\InvalidArgument(sprintf($this->exceptions[1], $class), 1); } // Check if we've already reflected this class if (static::$reflections->offsetExists($class)) { return static::$reflections->offsetGet($class); } // Create reflection $reflectionClass = new \ReflectionClass($class); $reflectionMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC); // Method container $methods = new Collection\Method(); // Loop through the class methods (Only public); foreach ($reflectionMethods as $reflectionMethod) { // Create method information entity $method = new Entity\Method(); $method->setName($reflectionMethod->getName()); // Get method parameters $reflectionParams = $reflectionMethod->getParameters(); // Evaluate the method params foreach ($reflectionParams as $reflectionParam) { // Create parameter information entity $parameter = new Entity\Parameter(); $parameter->setIndex($reflectionParam->getPosition()); $parameter->setName($reflectionParam->getName()); $parameter->setRequired($reflectionParam->isDefaultValueAvailable() === false); // Only set default value when param is optional if ($parameter->getRequired() === false) { $parameter->setDefault($reflectionParam->getDefaultValue()); } // Add the parameter to the container $method->addParameter($parameter); } // Add the method to the method container $methods->offsetSet(strtolower($method->getName()), $method); } // Cache reflection in the runtime self::$reflections->offsetSet($class, $methods); // Return the methods return $methods; }
/** * Extract array of var in object * @param Object $object * @returns array Array extracted of the object */ public function extractArray($object, $isRecursive = false) { if (method_exists($object, "toArray")) { return $object->toArray(); } $arrayCollection = new \ArrayIterator(); $reflection = new \ReflectionClass($object); $vars = array_keys($reflection->getdefaultProperties()); foreach ($vars as $key) { $value = $this->resolveGetNameMethod($key, $object); if ($value !== null) { if (is_object($value) && !$isRecursive) { $arrayCollection->offsetSet($key, $this->extractArray($value, true)); } else { $arrayCollection->offsetSet($key, $value); } } } return $arrayCollection->getArrayCopy(); }
/** * Get Annotations Found * * @return array * Found Annotations */ public function getAnnotations() { $data = new \ArrayIterator(); $domains = $this->matchDomainAnnotations($this->application); if (count($domains) > 0) { $data->offsetSet('Domains', $domains); } $data->offsetSet('Path', $this->matchPathAnnotation($this->application)); // Listing Controllers Methods and reducing (or amplifying) the list to its Action Methods $actions = $this->application->getControllers()->getIterator(); iterator_apply($actions, function (\Iterator $iterator) { $action = new Actions(new \ArrayIterator($iterator->current()->getClass()->getMethods())); $iterator->offsetSet($iterator->key(), $action->getAnnotations()); return TRUE; }, array($actions)); if ($actions->count() > 0) { $data->offsetSet('Routes', $actions->getArrayCopy()); } return $data; }
/** * Get the handler based on the namespace * * @param string $namespace * @return object * @throws Exception\ArgumentException */ protected function getHandler($namespace) { // Chack if namespace has been registered if ($this->handlers->offsetExists($namespace) === false) { throw new Exception\InvalidArgument(sprintf($this->exceptions[1], $namespace), 1); } // Create instance when needed if ($this->handlerInstances->offsetExists($namespace) === false) { $handler = $this->handlers->offsetGet($namespace); $this->handlerInstances->offsetSet($namespace, new $handler()); } // Return instance return $this->handlerInstances->offsetGet($namespace); }
public function addRequest(EntityRequest $request, $callable = null) { $id = $request->getId(); if ($id === null && $callable !== null) { throw new Exception\InvalidArgument('Request ID is NULL. This means no response for server. Cannot ' . 'attach callable to this request.', 1); } if ($id !== null && array_key_exists($id, $this->ids)) { throw new Exception\RuntimeException('Cannot add same id `' . $id . '` twice to the stack!'); } // Add the callable to the stack if ($id !== null) { $this->ids[$id] = $callable; } return parent::offsetSet(null, $request); }
function Search() { $arry = new ArrayIterator(); $chkOptionType = Request::RequestParams("rbticketType"); $txtForm = Request::RequestParams("txtForm"); $txtTo = Request::RequestParams("txtTo"); $txtDepatureDate = Request::RequestParams("txtDepatureDate"); $txtreturndate = Request::RequestParams("txtreturndate"); $sltflight = Request::RequestParams("sltflight"); $sltTicketType = Request::RequestParams("sltTicketType"); $txtadults = Request::RequestParams("txtadults"); $txtchildren = Request::RequestParams("txtchildren"); Session::set("children", $txtchildren); Session::set("adults", $txtadults); if ($_SERVER["REQUEST_METHOD"] == "POST") { //search on flights base on the given informations $this->db = new Database(); $statement = "select *from tbl_flight where to_where =:to_where or from_where=:from_where or " . " landingDate =:landingDate or BoardDate =:BoardDate or BoardingTime =:BoardingTime or " . " price =:price "; $smt = $this->db->prepare($statement); $smt->bindValue(":to_where", $txtTo); $smt->bindValue(":from_where", $txtForm); $smt->bindValue(":landingDate", $statement); $smt->bindValue(":BoardDate", $txtDepatureDate); $smt->bindValue(":BoardingTime", $txtreturndate); $smt->bindValue(":price", $statement); $status = $smt->execute(); if (!$status) { print_r($smt->errorInfo()); } //get all the results // $flight= new Flight(); Session::set("Searching", "1"); $counter = 0; while ($row = $smt->fetch(PDO::FETCH_ASSOC)) { $flight = new Flight(); $flight->Id = $row["id"]; $flight->Landingtime = $row["LandingTime"]; $flight->boardingTime = $row["BoardingTime"]; $flight->deptureDate = $row["BoardDate"]; $flight->from = $row["from_where"]; $flight->landindDate = $row["landingDate"]; $flight->stops = $row["noofstop"]; $flight->ticketPrice = $row["price"]; $flight->to = $row["to_where"]; $flight->seats = $row["seats"]; $flight->status = $row["status"]; $flight->planeID = $row["planeID"]; $arry->offsetSet($counter, $flight); $counter++; } } $this->ViewBag("Title", "Search flight"); $this->ViewBag("Controller", "Flight"); $this->ViewBag("Page", "SearchFlights"); $this->flightModelView->flightList = $arry; $controller = "Home"; $action = "Index"; ContextManager::PartialView("SearchFlights", "Flight"); Session::set("SubView", "SearchFlights"); return $this->View($this->flightModelView, $controller, $action); }
/** * @param LocationHelper $locHelper * @return $this */ public function addLocHelper(LocationHelper $locHelper) { $this->locations->offsetSet($locHelper->getLoc()["lid"], $locHelper); return $this; }
<?php include_once "entities/Flight.php"; include_once "models/FlightModel.php"; $model = new FlightModel(); $flightList = $model->GetAllDistinctFlights(); ?> <?php $object = new ArrayIterator(); $object->offsetSet("method", "post"); $object->offsetSet("class", "form form-horizontal "); ContextManager::BeginForm("Flight", "Search", $object); ?> <?php if (Session::get("db_username") == null) { ?> <div class="title border-sm-1">Search Flights</div> <?php } else { ?> <div class="title borderless ">Agent Flights Search </div> <?php } ?>
public function offsetSet($i, $val) { $this->changed = true; parent::offsetSet($i, $val); }
</div> <div class="form-group inline-fields sm-1"> <label>Description</label> <textarea class="form-control" name="desc_note"><?php echo $model->seat->desc; ?> </textarea> </div> <div class="form-group"> <?php $paramInput = new ArrayIterator(); $paramInput->offsetSet("class", "btn btn-primary"); if ($model->seat->mode == "edit") { $paramInput->offsetSet("type", "submit"); $paramInput->offsetSet("value", "Update"); ContextManager::HtmlInputField("btnUpdateSeat", $paramInput); } else { $paramInput->offsetSet("type", "submit"); $paramInput->offsetSet("value", "Add"); ContextManager::HtmlInputField("btnCreateSeat", $paramInput); } ?> </div> <?php ContextManager::EndForm();
public function set($field, $value) { $this->initialized[$field] = null; $this->data->offsetSet($field, $value); return $this; }
public function offsetSet($index, $newval) { $this->collection->offsetSet($index, $newval); parent::offsetSet($index, $newval); $this->refreshPositions(); }
/** * Append a ProductPurchaseMinMaxLine into container * * @param ProductPurchaseMinMaxLine $purchaseLine */ public function appendLine($purchaseLine) { $this->validate($purchaseLine); parent::offsetSet($purchaseLine->getIndex(), $purchaseLine); $this->rewind(); }
<?php $paramsLink = new ArrayIterator(); $paramsLink->offsetSet("class", "dropdown-toggle"); //$paramsLink->offsetSet("data-toggle", "dropdown"); ?> <div class="collapse navbar-collapse" id="myNavbar"> <ul class="nav navbar-nav"> <li> <?php if (Session::get("db_username") == null) { ContextManager::ActionLink("<span class='glyphicon glyphicon-home'></span> Home", "Home", "Index"); } else { ContextManager::ActionLink("<span class=\"glyphicon glyphicon-home\"></span> Account", "Account", "Index"); } ?> </li> <li> <?php ContextManager::ActionLink("<span class=\"glyphicon glyphicon-book\"></span> Bookings", "Account", "Booking"); ?> </li> <li > <?php ContextManager::ActionLink("<span class='glyphicon glyphicon-calendar'></span> Times Table", "Flight", "TimesTable", $paramsLink);
/** * Appends the value * @param Collectable $collectable */ public function append($collectable) { $this->validate($collectable); parent::offsetSet($collectable->getIndex(), $collectable); $this->rewind(); }
function Create($email, $firstname, $lastname, $phone, $password, $repassword, $sendButton = null) { $repassword = $repassword == "null" ? null : $repassword; $agent = new Agent(); $agent->set($firstname, $lastname, $email, $phone, $password); $agentModel = new AgentModel($agent); $list = $agentModel->GetUsers(); $this->agentModelView->agent = $agent; $this->agentModelView->agentList = $list; if ($agent->validated()) { if ($password != $repassword) { Session::set("warning", " Password mis-matched, re-enter passwords again!"); return $this->View($this->agentModelView, "Agent", "Create"); } else { $this->agentModelView->agentDbModel = $agentModel; if ($agentModel->Exists()) { Session::set("warning", "The user with the given email address [{$email}] already exists!"); } else { try { //else create the user if ($agentModel->Create()) { $sessionID = Validator::UniqueKey(20); $agentModel->SaveVerificationCode($email, $sessionID); //create a barcode $param = new ArrayIterator(); $param->offsetSet("username", $agent->email); $param->offsetSet("verificationCode", $sessionID); $url = ContextManager::CreateURL("Agent", "Login", $param); $imgPath = ContextManager::CreateQRBarcode($url, $agent->agentId); if ($this->_sendVerificationEmail($agent, $sessionID, $imgPath)) { //navigate to comfirmation page return $this->View($agent, "Agent", "Confirmation"); } else { Session::set("warning", "could not send mail "); $agentModel->DeleteAgent($email); } } } catch (Exception $err) { Session::set("warning", $err->getMessage()); } } } // create a database record here } else { Session::set("warning", $agent->getError()); } return $this->View($this->agentModelView, "Agent", "Create"); }
public function getDeadFiles() { $files = new ArrayIterator(); foreach ($this->files as $file) { if ($file->isDead()) { $files->offsetSet(null, $file); } } return $files; }
function GetAllDistinctFlights() { if ($this->db != null) { $query = "select * from tbl_flight where id !='null' group by from_where,to_where"; $stmt = $this->db->prepare($query); $stmt->execute(); $arry = new ArrayIterator(); $counter = 0; while ($row = $stmt->fetch(PDO::FETCH_BOTH)) { $flight = new Flight(); $flight->Id = $row["id"]; $flight->Landingtime = $row["LandingTime"]; $flight->boardingTime = $row["BoardingTime"]; $flight->deptureDate = $row["BoardDate"]; $flight->from = $row["from_where"]; $flight->landindDate = $row["landingDate"]; $flight->stops = $row["noofstop"]; $flight->ticketPrice = $row["price"]; $flight->to = $row["to_where"]; $flight->seats = $row["seats"]; $flight->status = $row["status"]; $flight->planeID = $row["planeID"]; $arry->offsetSet($counter, $flight); $counter++; } return $arry; } return null; }
/** * (non-PHPdoc) * @see ArrayIterator::offsetSet() */ public function offsetSet($name, $value) { if (!is_array($name)) { return parent::offsetSet($name, $value); } else { $key = array_shift($name); if (sizeof($name) == 0) { parent::offsetSet($key, $value); } else { $childArray = parent::offsetExists($key) ? parent::offsetGet($key) : new MultiDimArray(); if (!is_a($childArray, 'MultiDimArray')) { $childArray = new MultiDimArray(); } parent::offsetSet($key, $childArray); $childArray->offsetSet($name, $value); } } }
/** * Set value for an offset * * @param string $index The index to set for. * @param string $newval The new value to store at the index. */ public function offsetSet($index, $newval) { if ($index === 'class' && is_string($newval)) { $newval = preg_split('/\\s+/', $newval); } parent::offsetSet($index, $newval); }
<div class="col-lg-12"> <div id='container'> <div class='title'> Flight List : <?php ContextManager::ValidationFor("warning-l"); ?> </div> <?php $attr = new ArrayIterator(); $attr->offsetSet("method", "post"); ContextManager::BeginForm("Flight", "Modify", $attr); ?> <table width="100%" class="table table-heading borderless"> <tr class =""> <th>S/N</th> <th>Flight Name</th> <th>Source</th> <th>Destination</th> <th>Boarding Date</th> <th>Arrival Date</th> <th>Boarding Time</th> <th>Arrival Time</th> <th>Stops</th> <th>Price Rate</th>
/** * Set the value of the array, clear caches for that index * * @param mixed $index The array index * @param mixed $value Tha value to store */ public function offsetSet($index, $value) { unset($this->values[$index]); unset($this->raw_values[$index]); parent::offsetSet($index, $value); }