public static function recognize(Request $request, ContextManager $context) { // XXX: request URI hack, for medick installation in subfolders (e.g. `medick2` as base) // XXX: test with other servers and other types of PHP installations // $request->uri= substr($request->uri, strlen($context->config()->property('base', true))); $router = new Router($context->map()->find_route($request), $context); return $router->create_controller($request); }
public static function __setup(ContextManager $context) { self::$__context = $context; $model_paths = array(); foreach ($context->load_paths() as $path) { if (is_dir($path . 'app/models')) { $model_paths[] = $path . '/app/models/'; } } }
public static function load($stream, $environment) { if (ContextManager::$instance === NULL) { ContextManager::$instance = new ContextManager($stream, $environment); } return ContextManager::$instance; }
final function Content() { $this->_validate(); if ($this->_valid) { ContextManager::$Model = $this->model; //view bag the sub-page if ($this->subAction != null) { $this->ViewBag("SubAction", $this->subAction); } include_once $this->viewFile; } }
public static function discover(ContextManager $context) { // XXX: try to load plugins from <plugins> section if ($context->config()->property('plugin.autodiscovery') === false) { return array(); } $context->logger()->debug(strtolower(__METHOD__) . ' [hint: set `plugin.autodiscovery` to false to disable plugins]'); // plugins.path then fall to default $plugins_path = $context->config()->property('plugin.path') ? $context->config()->property('plugin.path') : MEDICK_PATH . '/../../vendor/plugins'; foreach (new DirectoryIterator($plugins_path) as $plugin_path) { Plugins::load_plugin($context, $plugin_path); } return Plugins::$registry; }
public static function load($file, $environment) { $start = microtime(true); // XXX: factory based on the file type for configurator $context = new ContextManager(new XMLConfigurator($file, $environment)); $context->timer($start)->tick(); return $context; }
private function _sendVerificationEmail($agent, $code, $attachment = null) { date_default_timezone_set('Etc/UTC'); $mail = new PHPMailer(); //Tell PHPMailer to use SMTP $mail->isSMTP(); $mail->SMTPDebug = 0; $mail->Debugoutput = 'html'; $mail->isHTML(true); $mail->Host = SMTP_HOST; $mail->Port = SMTP_PORT; $mail->SMTPSecure = 'tls'; $mail->SMTPAuth = true; $mail->Username = SMTP_EMAIL_ACCOUNT; $mail->Password = SMTP_PASSORD; //Set who the message is to be sent from $mail->setFrom('*****@*****.**', 'Obaro Isreal'); $mail->addReplyTo('*****@*****.**', 'Obaro Isreal'); $mail->addAddress($agent->email, $agent->firstname . " " . $agent->lastname); if ($attachment != null && file_exists($attachment)) { $mail->addAttachment($attachment, "Your Barcode"); } $mail->Subject = 'Welcome to flights.com[verification send]'; //add the html contents $message = " <h2>Account Details</h2> <br>Dear " . $agent->lastname . ",<br> " . "<p style='text-indent: 30px;'> Welcome to flights below is your account informations : <br>" . " Username : {$agent->email} <br> Password: {$agent->password}<br>" . " Verification Code : {$code}" . "<hr> Click on the below link to verify your account " . ContextManager::CreateLink("Verify my Account", "Agent", "Confirmation") . "</p> <br> or copy and paste on the browser this URL " . HOST_NAME . "?url=Agent&action=VerifyUser&code={$code} <hr>" . "<br>" . " <p>Alternatively scan the barcode with your phone or any device to quickly verified your email,, the barcode image is attached with this message</p> "; $mail->msgHTML($message); $status = $mail->send(); return $status; }
<?php // $Id$ // // This file is part of ${app.name} project // auto-generated on ${date} with medick version: ${medick.version} // // complete path to medick boot.php file. include_once '${medick.core}${ds}boot.php'; // complete path to ${app.name}.xml // and environment to load $d = new Dispatcher(ContextManager::load('${app.path}${ds}conf${ds}${app.name}.xml', 'localhost')); $d->dispatch();
<div class='container'> <div class="row "> <div class="col-lg-7"> <?php include_once "Create.php"; ?> </div> </div> <?php ContextManager::PartialView("display", "plane"); ContextManager::PartialView("display"); ?> </div>
<?php // $Id$ // // This file is part of shop project // auto-generated on 2006 Apr 16 11:13:18 with medick version: 0.2.3-svn // // complete path to medick boot.php file. include_once '/wwwroot/medick/trunk/boot.php'; // complete path to shop.xml // and environment to load $d = new Dispatcher(ContextManager::load('/wwwroot/rwd/trunk/medickart/conf/medickart.xml', 'gremlin')); $d->dispatch();
<link href="styles/home.css" rel="stylesheet" type="text/css" /> <script> </script> <div class="container-fluid" > <div class="row-fluid"> <div class="col-sm-4 bg_panel "> <?php require_once "search_flight.php"; ?> </div> <div class="col-sm-7 panel panel-body cell-right-2" > <?php @ContextManager::Display($this->ViewBag("Controller"), $this->ViewBag("Page")); ?> </div> </div> </div>
<?php // $Id: $ // load the framework include_once 'boot.php'; // dispatch with complete path to cFields.xml and the environment to load $d = new Dispatcher(ContextManager::load('config/cfields.xml', 'test')); $d->dispatch();
private static function _exec($clsObject, $methodCall) { $method = new ReflectionMethod(self::$controller, self::$action); self::$context = $method->invokeArgs($clsObject, self::$request->Parameters()); }
public function Update($seatId, $planeID, $seatNo, $rate, $type, $Desc, $press = null) { $seat = new Seat(); $seat->set($seatNo, $planeID, $Desc, $type, $rate); $seat->id = $seatId; $seat->mode = "edit"; $this->modelview->seat = $seat; Session::set("selected_plane_id", $planeID); Session::set("type_plane", $type); $model = new SeatModel($seat, $this->db); if (!$model->IsIdExists($seatId)) { ContextManager::ValidationFor("warning", "Oops! there is no flight seats selected to modify"); return $this->View($this->modelview, "Seat", "Index"); } $model->Update(); $this->modelview->seatModel = $model; $this->ViewBag("Title", "Seats"); $this->ViewBag("Controller", "Seat"); $this->ViewBag("Page", "Index"); return $this->View($this->modelview, "Account", "Index"); }
public function __construct(ContextManager $context) { $this->metadata = array('name' => $this->class_name(), 'author' => 'Joe Doe', 'version' => 0.1, 'url' => 'http://example.com/foo_plugin'); $context->logger()->debugf("Plugin %s loaded", $this->name()); parent::__construct($context); }
<a href="#" class="show-sidebar"> <i class="fa fa-bars"></i> </a> <div id="search"> <input type="text" placeholder="search"/> <i class="fa fa-search"></i> </div> </div> <?php require_once "menu.php"; ?> </div> </div> </div> </div> </header> <!--End Header--> <!--Start Container--> <div id="main" class="container-fluid"> <?php ContextManager::RenderContext(); ?> </div> <script src="scripts/devoops.js"></script> </body> </html>
<?php // $Id: index.php 379 2006-03-18 17:36:03Z aurelian $ // // This file is part of cFields project // auto-generated on 2008 Mar 11 16:52:31 with medick version: 0.4.1 // // complete path to medick boot.php file. include_once '/W/Devel/medick/exp/medick2/boot.php'; // complete path to cFields.xml // and environment to load $d = new Dispatcher(ContextManager::load('/W/Devel/medick/exp/medick2/config/cfields.xml', 'localhost')); $d->dispatch();
<li > <?php ContextManager::ActionLink("<span class='glyphicon glyphicon-calendar'></span> Times Table", "Flight", "TimesTable", $paramsLink); ?> </li> <li > <?php ContextManager::ActionLink("<span class='glyphicon glyphicon-plane'></span> Destinations", "Flight", "Destinations", $paramsLink); ?> </li> <li> <?php if (Session::get("db_username") == null) { ContextManager::ActionLink("<span class=\"glyphicon glyphicon-user\"></span> Travel Agent", "Agent", "LoginForm"); } else { ContextManager::ActionLink("<span class=\"glyphicon glyphicon-log-out\"></span> Log out", "Account", "Logout"); } ?> </li> </ul> </div>
/** * Sets a new factory class * * @param Factory\FactoryInterface * @return Context\Manager */ public function setFactory(Factory\FactoryInterface $factory) { self::$factory = $factory; return $this; }
public final function _Default() { ContextManager::PartialView(DEFAULT_ACTION); }
<?php // $Id$ // // This file is part of testor project // auto-generated on 2006 Mar 22 21:16:32 with medick version: 0.2.2-svn // // complete path to medick boot.php file. include_once '/wwwroot/medick/trunk/boot.php'; // complete path to testor.xml // and environment to load $d = new Dispatcher(ContextManager::load('/wwwroot/medick/applications/testor/conf/testor.xml', 'gremlin')); $d->dispatch();
public function AddPassenger($formno, $title, $firstname, $lastname, $btnpress = null) { $passenger = new Passenger(); $passenger->formid = $formno; $passenger->title = $title; $passenger->firstname = $firstname; $passenger->lastname = $lastname; $passenger->analyser(); $passenger_list = Session::get("Passengers"); if ($passenger_list == NULL) { $passenger_list = []; } if ($passenger->validated()) { } else { Session::set("passage-form", $formno); ContextManager::ValidationFor("warning", $passenger->getError()); } $passenger_list[$formno] = $passenger; Session::set("Passengers", $passenger_list); Session::set("Passager-Valid", $this->countValidPessenger()); $this->ViewBag("Controller", "Booking"); $this->ViewBag("Page", "PassenderForms"); return $this->View($this->viewModel->flightDbModel, "Booking", "Index"); }
<?php require_once "config/master.php"; require_once "config/_startApp.php"; Session::init(); //This will load the current web template to use ContextManager::StartApplication(); ?>
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); }
?> <li> <?php if (Session::get("db_username") == null) { ContextManager::ActionLink("<span class='glyphicon glyphicon-plus'></span> Register!", "Agent", "Create", $paramsLink); } else { } ?> </li> <li> <?php if (Session::get("db_username") == null) { $paramsLink->offsetSet("class", "nav-list btn-info"); ContextManager::ActionLink("Forget Password!", "Agent", "ForgetPassword", $paramsLink); } else { ContextManager::ActionLink("<span class ='glyphicon glyphicon-user'></span> Profile", "Account", "Profile", $paramsLink); } ?> </li> <li class='top-search-listitem'> <form class="form-inline" role="form"> <div class="form-group"> <input type="text" class="form-control top-search" id="txtsearchbox"> </div> <button type="submit" class="btn btn-info ">Find</button> </form> </li>
if ($year == null) { $year = date("Y", time()); } $number = cal_days_in_month(CAL_GREGORIAN, $intMonth, $year); return intval($number); } ?> <div class="row"> <div class="col-sm-5 search-panel"> <?php $object = new ArrayIterator(); $object->offsetSet("class", "form form-horizontal"); $object->offsetSet("method", "post"); ContextManager::BeginForm("Flight", "TimesTable", $object); ?> <div class='title'>Search Flights's Time Table</div> <div class="form-group inline-fields sm-1"> <label for="txtFrom">Location From:</label> <select id='txtFrom' name='txtFrom' class='form-control'> <option value="">source...</option> <?php foreach ($flightList as $flight) { echo "<option value='{$flight->from}' >{$flight->from}</option>"; } ?> </select>
public final function __construct(ContextManager $context) { $this->context = $context; $this->logger = $context->logger(); $this->config = $context->config(); }
<?php // $Id: index.php 376 2006-03-12 08:04:30Z aurelian $ // // This file is part of eltodo project // auto-generated on with medick version: 0.2.1 // // complete path to medick boot.php file. include_once '/wwwroot/medick/trunk/boot.php'; // complete path to eltodo.xml // and environment to load $d = new Dispatcher(ContextManager::load('/wwwroot/medick/applications/eltodo/conf/eltodo.xml', 'localhost')); $d->dispatch();
} else { $status = "active"; } $name = $aplanes->GetName($flight->planeID); echo "<tr>\r\n <td>{$var}</td>\r\n <td>{$name}</td>\r\n <td>{$flight->from}</td>\r\n <td>{$flight->to}</td>\r\n <td>{$flight->deptureDate}</td>\r\n <td>{$flight->landindDate}</td>\r\n <td>{$flight->boardingTime}</td>\r\n <td>{$flight->Landingtime}</td>\r\n <td>{$flight->stops}</td>\r\n <td>{$flight->ticketPrice}</td>\r\n <td>{$flight->seats}</td>\r\n <td>{$status}</td>\r\n <td><input type='checkbox' value='{$flight->Id}' name='chkflights[]' {$checked} ></td>\r\n </tr>\r\n "; } ?> </table> <div id="btn_panel_modifier"> <input type="submit" class="btn btn-primary" value="Edit/Modify" name="btnEdit"/> <input type="submit" class="btn btn-primary" value="Delete" name="btnDelete"/> </div> <?php ContextManager::EndForm(); ?> </div> </div> <!--Another record database--> </div>
function SaveChanges($id, $name, $seats, $description, $buttonPress) { $id = $id == "null" ? null : $id; $name = $name == "null" ? null : $name; $seats = $seats == "null" ? null : $seats; $description = $description == "null" ? null : $description; $buttonPress = $buttonPress == "null" ? null : $buttonPress; $plane = new Plane(); $plane->set($name, $seats, $description); $plane->Id = $id; $plane->mode = "edit"; $this->modelView->plane = $plane; $this->modelView->planeModel = new PlaneModel($plane); if ($this->modelView->plane->validated()) { $this->modelView->planeModel->Update(); } else { ContextManager::ValidationFor("warning", $this->modelView->plane->getError()); } $this->ViewBag("Title", "Save Changes"); $this->ViewBag("Controller", "Plane"); $this->ViewBag("Page", "Index"); return $this->View($this->modelView, "Account", "Index"); }