public function init() { parent::init(); \Pinst::$app->registerShutdownFunction(function ($app) { $app->errorHandel->unregister(); }); }
/** * Sets an order as the current order. * @param Int | Order $order * @return Boolean */ public function loadOrder($order) { //TODO: how to handle existing order //TODO: permission check - does this belong to another member? ...or should permission be assumed already? if (is_numeric($order)) { $this->order = DataObject::get_by_id('Order', $order); } elseif ($order instanceof Order) { $this->order = $order; } if ($this->order) { if ($this->order->canView()) { $this->order->init(true); $sessionVariableName = $this->sessionVariableName("OrderID"); Session::set($sessionVariableName, $this->order->ID); $this->addMessage(_t("ShoppingCart.LOADEDEXISTING", "Order loaded."), 'good'); return true; } else { $this->addMessage(_t("ShoppingCart.NOPERMISSION", "You do not have permission to view this order."), 'bad'); return false; } } else { $this->addMessage(_t("ShoppingCart.NOORDER", "Order can not be found."), 'bad'); return false; } }
protected function init(NamedArguments $arguments) { parent::init($arguments); $this->issn = $arguments->issn; $this->isbn = $arguments->isbn; $this->config = new Configuration(); //determine the full URL //change the string sent to SFX depending on whether ISBN or ISSN was passed in if ($this->isbn) { $stringAppend = "&isbn=" . $this->isbn; } else { $stringAppend = "&issn=" . $this->issn; } //get the sfx open URL out of the config settings $open_url = $this->config->settings->open_url; //check if there is already a ? in the URL so that we don't add another when appending the parms if (strpos($open_url, "?") > 0) { $open_url .= "&"; } else { $open_url .= "?"; } $sid = $this->config->settings->sid; if ($sid) { $open_url .= "rfr_id=info:sid/" . $sid; } $this->open_url = $open_url . "&sfx.ignore_date_threshold=1&sfx.response_type=simplexml" . $stringAppend; }
protected function init(NamedArguments $arguments) { parent::init($arguments); $this->issn = $arguments->issn; $this->isbn = $arguments->isbn; $this->config = new Configuration(); }
/** * Sets an order as the current order. * @param Int | Order $order * @return Boolean */ public function loadOrder($order) { //TODO: how to handle existing order //TODO: permission check - does this belong to another member? ...or should permission be assumed already? if (is_numeric($order)) { $this->order = Order::get()->byID($order); } elseif (is_a($order, Object::getCustomClass("Order"))) { $this->order = $order; } else { user_error("Bad order provided as parameter to ShoppingCart::loadOrder()"); } if ($this->order) { if ($this->order->canView()) { $this->order->init(true); $sessionVariableName = $this->sessionVariableName("OrderID"); Session::set($sessionVariableName, $this->order->ID); $this->addMessage(_t("Order.LOADEDEXISTING", "Order loaded."), 'good'); return true; } else { $this->addMessage(_t("Order.NOPERMISSION", "You do not have permission to view this order."), 'bad'); return false; } } else { $this->addMessage(_t("Order.NOORDER", "Order can not be found."), 'bad'); return false; } }
public function init() { parent::init(); \Pinst::$app->registerShutdownFunction(function ($app) { $app->logger->save(); }); }
protected function init(NamedArguments $arguments) { parent::init($arguments); $this->issn = $arguments->issn; $this->isbn = $arguments->isbn; $this->config = new Configuration(); //determine the full open URL //change the string sent depending on whether ISBN or ISSN was passed in if ($this->isbn) { $stringAppend = "&rft.isbn=" . $this->isbn; } else { $stringAppend = "&rft.issn=" . $this->issn; } //get the client identifier out of the config settings $client_identifier = $this->config->settings->client_identifier; $this->open_url = "http://" . $client_identifier . ".openurl.xml.serialssolutions.com/openurlxml?version=1.0&url_ver=Z39.88-2004" . $stringAppend; }
/** * When initiating set value for self::$_self; so that it can be called from ::get(); * Multiple values will be set for that, one for each config variant that is initiated. * @param string[] $config Config values that were used when the object was instantiated. */ protected function init($config) { $this->addNamespace(self::APP_DEVELOPER_VENDORKEY, APP_ROOT); self::$_self[md5(serialize($config))] = $this; return parent::init(); }
$params[$k] = $v; } return $params; } public function getType() { return substr($this->_id, 0, strpos($this->_id, ".")); } public function __toJSON() { if (defined('JSON_PRETTY_PRINT')) { return json_encode($this->__toArray(true), JSON_PRETTY_PRINT); } else { return json_encode($this->__toArray(true)); } } public function __toString() { return $this->__toJSON(); } public function __toArray($recursive = false) { if ($recursive) { return Util::convertIxfObjectToArray($this->_values); } else { return $this->_values; } } } Object::init();
/** * {@inheritdoc} */ public function init(array $data) { parent::init($data); $this->setOption('target', $this->getId()); }
public function init() { parent::init(); }