本文整理汇总了PHP中CApp::rip方法的典型用法代码示例。如果您正苦于以下问题:PHP CApp::rip方法的具体用法?PHP CApp::rip怎么用?PHP CApp::rip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApp
的用法示例。
在下文中一共展示了CApp::rip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
* Connect to a AS400 DB2 SQL server via ODBC driver
*
* @throws Error on misconfigured or anavailable server
*
* @return void
*/
static function connect()
{
if (self::$dbh) {
return;
}
$config = CAppUI::conf("sante400");
if (null == ($dsn = $config["dsn"])) {
trigger_error("Data Source Name not defined, please configure module", E_USER_ERROR);
CApp::rip();
}
// Fake data source for chrono purposes
CSQLDataSource::$dataSources[$dsn] = new CMySQLDataSource();
$ds =& CSQLDataSource::$dataSources[$dsn];
$ds->dsn = $dsn;
self::$chrono =& CSQLDataSource::$dataSources[$dsn]->chrono;
self::$chrono->start();
$prefix = $config["prefix"];
try {
self::$dbh = new PDO("{$prefix}:{$dsn}", $config["user"], $config["pass"]);
self::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
mbTrace("cauguht failure on first datasource");
if (null == ($dsn = $config["other_dsn"])) {
throw $e;
}
self::$dbh = new PDO("{$prefix}:{$dsn}", $config["user"], $config["pass"]);
self::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
self::$chrono->stop("connection");
self::traceChrono("connection");
}
示例2: init
/**
* @see parent::init()
*/
function init()
{
if (!CMbPath::forceDir($this->dir)) {
trigger_error("Shared memory could not be initialized, ensure that '{$this->dir}' is writable");
CApp::rip();
}
return true;
}
示例3: doStore
/**
* @see parent::doStore()
*/
function doStore()
{
if (isset($_FILES['attachment'])) {
$mail_id = CValue::post('mail_id');
$mail = new CUserMail();
$mail->load($mail_id);
$files = array();
foreach ($_FILES['attachment']['error'] as $key => $file_error) {
if (isset($_FILES['attachment']['name'][$key])) {
$files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
}
}
foreach ($files as $_key => $_file) {
if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
continue;
}
if ($_file['error'] != 0) {
CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
continue;
}
$attachment = new CMailAttachments();
$attachment->name = $_file['name'];
$content_type = mime_content_type($_file['tmp_name']);
$attachment->type = $attachment->getTypeInt($content_type);
$attachment->bytes = $_file['size'];
$attachment->mail_id = $mail_id;
$content_type = explode('/', $content_type);
$attachment->subtype = strtoupper($content_type[1]);
$attachment->disposition = 'ATTACHMENT';
$attachment->extension = substr(strrchr($attachment->name, '.'), 1);
$attachment->part = $mail->countBackRefs('mail_attachments') + 1;
$attachment->store();
$file = new CFile();
$file->setObject($attachment);
$file->author_id = CAppUI::$user->_id;
$file->file_name = $attachment->name;
$file->file_date = CMbDT::dateTime();
$file->fillFields();
$file->updateFormFields();
$file->doc_size = $attachment->bytes;
$file->file_type = mime_content_type($_file['tmp_name']);
$file->moveFile($_file, true);
if ($msg = $file->store()) {
CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
CApp::rip();
}
$attachment->file_id = $file->_id;
if ($msg = $attachment->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
CApp::rip();
}
}
CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
} else {
parent::doStore();
}
}
示例4: storeObject
/**
* Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
*
* @param CMbObject $object Objet à enregister
*
* @return void
*/
function storeObject($object)
{
$title = $object->_id ? "-msg-modify" : "-msg-create";
if ($msg = $object->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
echo CAppUI::getMsg();
CApp::rip();
}
CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
示例5: redirect
/**
* Redirect to the last page
*
* @return void
*/
function redirect()
{
if (CValue::post("ajax")) {
echo CAppUI::getMsg();
CApp::rip();
}
$m = CValue::post("m");
$tab = CValue::post("tab");
CAppUI::redirect("m={$m}&tab={$tab}");
}
示例6: checkForSejour
/**
* check if the sejour need to be unlock
*
* @param CSejour $sejour
*
* @return bool
*/
static function checkForSejour($sejour, $modal = true)
{
if (!self::canAccess($sejour)) {
$smarty = new CSmartyDP("modules/admin");
$smarty->assign("sejour", $sejour);
$smarty->assign("bris", new CBrisDeGlace());
$smarty->assign("modale", $modal);
$smarty->display("need_bris_de_glace.tpl");
CApp::rip();
}
return true;
}
示例7: applyRedirection
/**
* Effectue la redirection d'après la règle
*
* @return bool
*/
function applyRedirection()
{
$scheme = "http" . (isset($_SERVER["HTTPS"]) ? "s" : "");
$host = $_SERVER["SERVER_NAME"];
$port = $_SERVER["SERVER_PORT"] == 80 ? "" : ":{$_SERVER['SERVER_PORT']}";
$params = $_SERVER["REQUEST_URI"];
$this->parseUrl();
if ($this->_complete_to["scheme"] == $scheme && $this->_complete_to["host"] == $host) {
return true;
}
if ($this->from == "*") {
header("Location: {$this->to}{$params}");
CApp::rip();
}
if ($this->_complete_from["scheme"] == $scheme && $this->_complete_from["host"] == $host) {
$scheme = $this->_complete_to["scheme"];
$host = $this->_complete_to["host"];
$redirection = $scheme . "://" . $host;
$redirection .= $params;
header("Location: {$redirection}");
CApp::rip();
}
return false;
}
示例8: doRedirect
function doRedirect($demandeSynchro = false)
{
if ($this->ajax) {
if ($this->synchro) {
$del = CValue::post("del", 0);
$tmp_repas_id = CValue::post("_tmp_repas_id", 0);
$msgSystem = CAppUI::getMsg();
$smarty = new CSmartyDP("modules/dPrepas");
$smarty->assign("del", $del);
$smarty->assign("tmp_repas_id", $tmp_repas_id);
$smarty->assign("demandeSynchro", $demandeSynchro);
$smarty->assign("msgSystem", $msgSystem);
$smarty->assign("callBack", $this->callBack);
if ($demandeSynchro) {
$smarty->assign("object", $this->_old);
}
$smarty->display("add_del_repas_offline.tpl");
}
CApp::rip();
}
if ($this->redirect !== null) {
CAppUI::redirect($this->redirect);
}
}
示例9: store
/**
* @see parent::store()
*/
function store()
{
if ($this instanceof CSejour || $this instanceof COperation) {
global $can;
$this->loadOldObject();
$this->completeField("cloture_activite_1", "cloture_activite_4", 'codes_ccam');
if (!$can->admin && CAppUI::conf("dPsalleOp CActeCCAM signature") && ($this->cloture_activite_1 || $this->cloture_activite_4) && $this->fieldModified("codes_ccam") && strcmp($this->codes_ccam, $this->_old->codes_ccam)) {
$new_code = substr($this->codes_ccam, strlen($this->_old->codes_ccam) + 1);
$code_ccam = new CDatedCodeCCAM($new_code);
$code_ccam->getRemarques();
$activites = $code_ccam->getActivites();
if (isset($activites[1]) && $this->cloture_activite_1) {
CAppUI::setMsg("Impossible de rajouter un code : l'activité 1 est clôturée", UI_MSG_ERROR);
echo CAppUI::getMsg();
CApp::rip();
}
if (isset($activites[4]) && $this->cloture_activite_4) {
CAppUI::setMsg("Impossible de rajouter un code : l'activité 4 est clôturée", UI_MSG_ERROR);
echo CAppUI::getMsg();
CApp::rip();
}
}
}
// Standard store
if ($msg = parent::store()) {
return $msg;
}
if ($this->_delete_actes && $this->_id) {
if ($msg = $this->deleteActes()) {
return $msg;
}
}
return null;
}
示例10: doCallback
/**
* Make JavaScript callback
*
* @return void
*/
function doCallback()
{
$messages = CAppUI::$instance->messages;
echo CAppUI::getMsg();
$fields = $this->_obj->getProperties();
$fields["_guid"] = $this->_obj->_guid;
$fields["_class"] = $this->_obj->_class;
foreach ($messages as &$_level) {
$_keys = array_map("utf8_encode", array_keys($_level));
$_values = array_map("utf8_encode", array_values($_level));
$_level = array_combine($_keys, $_values);
}
$fields["_ui_messages"] = $messages;
$id = $this->_obj->_id ? $this->_obj->_id : 0;
if ($this->callBack) {
CAppUI::callbackAjax($this->callBack, $id, $fields);
} else {
$guid = "{$this->className}-{$id}";
CAppUI::callbackAjax("Form.onSubmitComplete", $guid, $fields);
}
if (!CAppUI::$mobile) {
CApp::rip();
}
}
示例11: streamDocForObject
/**
* Stream document for object
*
* @param CCompteRendu $compte_rendu Document
* @param CMbObject $object Object
* @param string $factory Factory name
*
* @return void
*/
static function streamDocForObject($compte_rendu, $object, $factory = null)
{
ob_clean();
$template = new CTemplateManager();
$source = $compte_rendu->getFullContentFromModel();
$object->fillTemplate($template);
$template->renderDocument($source);
$htmltopdf = new CHtmlToPDF($factory);
$htmltopdf->generatePDF($template->document, 1, $compte_rendu, new CFile());
CApp::rip();
}
示例12: output
/**
* Output the content to the standard output
*
* @return void
*/
static function output($options = array())
{
if (self::$_aio) {
$path = CAppUI::getTmpPath("embed-" . md5(uniqid("", true)));
if (self::$_aio === "savefile") {
$str = self::allInOne($path);
file_put_contents("{$path}/index.html", $str);
$zip_path = "{$path}.zip";
CMbPath::zip($path, $zip_path);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=\"" . basename($zip_path) . "\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($zip_path));
readfile($zip_path);
unlink($zip_path);
CMbPath::remove($path);
CApp::rip();
} else {
self::allInOne(null, $options);
}
} else {
// Flush zero-ifies ob_get_length
self::$flushed_output_length += ob_get_length();
ob_end_flush();
}
}
示例13: redirect
/**
* $Id: do_prescription_export.php 19460 2013-06-07 09:39:26Z kgrisel $
*
* @package Mediboard
* @subpackage Labo
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision: 19460 $
*/
function redirect()
{
echo CAppUI::getMsg();
CApp::rip();
}
示例14: stepAjax
/**
* Display an AJAX step, and exit on error messages
*
* @param string $msg The internationalized message
* @param int $type [optional] Message type as a UI constant
* @param mixed $_ [optional] Any number of printf-like parameters to be applied
*
* @return void
* @todo Switch parameter order, like stepMessage()
* @todo Rename to ajaxNsg()
*/
static function stepAjax($msg, $type = UI_MSG_OK, $_ = null)
{
$args = func_get_args();
$msg = CAppUI::tr($msg, array_slice($args, 2));
$msg = CMbString::purifyHTML($msg);
$class = self::getErrorClass($type);
echo "\n<div class='{$class}'>{$msg}</div>";
if ($type == UI_MSG_ERROR) {
CApp::rip();
}
}
示例15: fixBlockElements
/**
* Correction de problèmes de dom
*
* @param string $str source html
*
* @return string
*/
function fixBlockElements($str)
{
$xml = new DOMDocument('1.0', 'iso-8859-1');
$str = CMbString::convertHTMLToXMLEntities($str);
$str = CHtmlToPDF::cleanWord($str);
// Suppression des caractères de contrôle
$from = array(chr(3), chr(7));
$to = array("", "");
$str = str_replace($from, $to, $str);
$xml->loadXML(utf8_encode($str));
$html =& $xml->getElementsByTagName("body")->item(0);
if (is_null($html)) {
$html =& $xml->firstChild;
}
if (is_null($html)) {
CAppUI::stepAjax("CCompteRendu-empty-doc");
CApp::rip();
}
$xpath = new DOMXpath($xml);
$elements = $xpath->query("*/div[@id='body']");
if (!is_null($elements)) {
foreach ($elements as $_element) {
CHtmlToPDF::removeAlign($_element);
}
}
// Solution temporaire pour les problèmes de mise en page avec domPDF
while ($elements = $xpath->query("//span[@class='field']")) {
if ($elements->length == 0) {
break;
}
foreach ($elements as $_element) {
foreach ($_element->childNodes as $child) {
/** @var DOMElement $child */
$_element->parentNode->insertBefore($child->cloneNode(true), $_element);
}
$_element->parentNode->removeChild($_element);
}
}
$this->recursiveRemove($html);
$this->recursiveRemoveNestedFont($html);
$this->resizeTable($html);
// Suppression des sauts de pages dans l'entête et le pied de page
$elements = $xpath->query("//div[@id='header']//hr[@class='pagebreak']");
if (!is_null($elements)) {
foreach ($elements as $_element) {
$_element->parentNode->removeChild($_element);
}
}
$elements = $xpath->query("//div[@id='footer']//hr[@class='pagebreak']");
if (!is_null($elements)) {
foreach ($elements as $_element) {
$_element->parentNode->removeChild($_element);
}
}
$str = $xml->saveHTML();
$str = preg_replace("/<br>/", "<br/>", $str);
return $str;
}