本文整理汇总了PHP中TemplatePower::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplatePower::prepare方法的具体用法?PHP TemplatePower::prepare怎么用?PHP TemplatePower::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplatePower
的用法示例。
在下文中一共展示了TemplatePower::prepare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Main
function Main()
{
global $TPLV, $bottom, $urls, $db, $migalha;
$TPLV = new TemplatePower(TEMPLATE_PATH . "modulos/categoria.tpl");
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH_SITE);
$TPLV->assignGlobal("imagePath", IMAGE_PATH);
$TPLV->assignGlobal("swfPath", SWF_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH_SITE);
$TPLV->assignGlobal('navBottom', $bottom);
$TPLV->assignGlobal($urls->var);
$TPLV->prepare();
$in = $_GET['in'];
switch ($in) {
default:
case 'lista':
lista();
break;
case 'novo':
novo();
break;
case 'editar':
editar();
break;
case 'salvar':
salvar();
break;
case 'deletar':
deletar();
break;
}
}
示例2: Main
function Main()
{
global $TPLV, $urls, $usuario, $imovel;
$TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
$TPLV->assignGlobal("imagePath", IMAGE_PATH);
$TPLV->assignGlobal("swfPath", SWF_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH);
$TPLV->assignGlobal('navBottom', $bottom);
$TPLV->assignGlobal($urls->var);
$TPLV->prepare();
$in = $_GET['in'];
switch ($in) {
//FILTROS DE BUSCAS
default:
case 'deletaUsuario':
deletaUsuario();
break;
case 'deletaMidia':
deletaMidia();
break;
//LOGIN E RECUPERA SENHA
//LOGIN E RECUPERA SENHA
case 'getLogin':
getLogin();
break;
case 'login':
login();
break;
case 'getSenha':
getSenha();
break;
case 'recuperaSenha':
recuperaSenha();
break;
case 'isLogado':
if ($usuario->isLogado()) {
echo 'logado';
} else {
echo 'erro';
}
break;
//CADASTRO
//CADASTRO
case 'validaEmailCadastro':
validaEmailCadastro();
break;
//LEADS DETALHES
//LEADS DETALHES
case 'getCadastro':
getCadastro();
break;
case 'salvarCadastro':
salvarCadastro();
break;
case 'verificaCPF':
verificaCPF();
break;
}
}
示例3: Main
function Main()
{
global $TPLV, $bottom, $db, $migalha, $usuario;
$TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
$TPLV->assignGlobal("imagePath", IMAGE_PATH);
$TPLV->assignGlobal("swfPath", SWF_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH);
$TPLV->assignGlobal('navBottom', $bottom);
$TPLV->prepare();
$in = $_GET['in'];
switch ($in) {
default:
case 'restrito':
if ($usuario->isLogado()) {
inicio();
} else {
restrito();
}
break;
case 'inicio':
inicio();
break;
case 'logout':
logout();
break;
}
}
示例4: consultarReserva
public function consultarReserva()
{
$proteccion = new Proteccion();
$cod_reserva = $proteccion->html($_POST['cod_reserva']);
$reserva = new Reserva();
$result = $reserva->BuscarReserva($cod_reserva);
foreach ($result['result'] as $r) {
$cod_reserva = $r['cod_reserva'];
}
$nom_hotel = $r['nom_hotel'];
$nombre = $r['nombre'];
$apellido = $r['apellido'];
$email = $r['email'];
$fec_llegada = $r['fec_llegada'];
$fec_salida = $r['fec_salida'];
$fec_reserva = $r['fec_reserva'];
$piso = $r['piso'];
$ubicacion = $r['ubicacion'];
$tp = new TemplatePower("templates/reserva.html");
$tp->prepare();
$tp->gotoBlock("_ROOT");
$tp->newBlock("generarreserva");
$tp->assign("cod_reserva", $cod_reserva);
$tp->assign("nom_hotel", $nom_hotel);
$tp->assign("nombre", $nombre);
$tp->assign("apellido", $apellido);
$tp->assign("email", $email);
$tp->assign("fec_llegada", $fec_llegada);
$tp->assign("fec_salida", $fec_salida);
$tp->assign("fec_reserva", $fec_reserva);
$tp->assign("piso", $piso);
$tp->assign("ubicacion", $ubicacion);
echo $tp->getOutputContent();
}
示例5: registrar
public function registrar()
{
$proteccion = new Proteccion();
$nombre = $proteccion->html($_POST['nombre']);
$apellido = $proteccion->html($_POST['apellido']);
$sexo = $proteccion->html($_POST['sexo']);
$fecha_nacimiento = $proteccion->html($_POST['fecha_nacimiento']);
$direccion = $proteccion->html($_POST['direccion']);
$email = $proteccion->html($_POST['email']);
$dni = $proteccion->html($_POST['dni']);
$pass = $proteccion->html($_POST['password']);
$persona = new Usuario($email, $pass);
$existe = $persona->existe();
if ($existe) {
$tp = new TemplatePower("templates/registro.html");
$tp->prepare();
$tp->gotoBlock("_ROOT");
$tp->newblock("no_registro");
$tp->assign("usuario", $email);
$webapp = $tp->getOutputContent();
} else {
$persona->setDatosUsuario($nombre, $apellido, $sexo, $fecha_nacimiento, $direccion, $dni);
$persona->insertar();
$_SESSION['user'] = $email;
$tp = new TemplatePower("templates/index.html");
$tp->prepare();
$tp->gotoBlock("_ROOT");
$tp->newBlock("sesion");
$tp->assign("usuario", $_SESSION['user']);
$webapp = $tp->getOutputContent();
}
echo $webapp;
}
示例6: makePlanetTooltip
function makePlanetTooltip($options, $actions, $actionName = 'missiontype')
{
global $lang;
if (!$options or !is_array($options)) {
return false;
}
$tp = new TemplatePower(PATH . TEMPLATE_DIR . TEMPLATE_NAME . "/planet_actions.tpl");
$tp->prepare();
switch ($options[type]) {
case "planet":
$tp->newBlock("planet");
break;
case "moon":
$tp->newBlock("moon");
break;
case "debris":
$tp->newBlock("debris");
break;
case "ally":
$tp->newBlock("ally");
break;
default:
return false;
break;
}
$actionName = $lang[$actionName];
foreach ($options as $k => $v) {
$tp->assign($k, $v);
}
if ($actions and is_array($actions)) {
foreach ($actions[id] as $k => $actionId) {
//echo $actionId . "<-- <br>";
$tp->newBlock($options[type] . "_actions");
$tp->assign("action_name", $actionName[$actionId]);
$tp->assign("action_link", $actions[alink][$k]);
}
}
$tool = $tp->getOutputContent();
$find = array('"', "'", "\n", "\r");
$rep = array('\\"', "\\'", "", "");
$tool = str_replace($find, $rep, $tool);
return $tool;
}
示例7: hotel
function hotel($idHotel)
{
$mhotels = new MHotels();
$result = $mhotels->buscar_id($idHotel);
foreach ($result['result'] as $r) {
$nombreHotel = $r['nom_hotel'];
$prov = $r['provincia'];
$local = $r['localidad'];
$calle = $r['calle'];
$ncalle = $r['nro_calle'];
$tel = $r['telefono'];
$precio = $r['precio_persona'];
$cant_imagenes = $r['cant_imagenes'];
$descripcion = $r['descripcion'];
}
$tp = new TemplatePower("templates/hotel.html");
$tp->prepare();
$tp->gotoBlock("_ROOT");
$tp->assign("nombre", $nombreHotel);
for ($i = 1; $i <= $cant_imagenes; $i++) {
$tp->newBlock("imagenes");
$tp->assign("nombre", $nombreHotel);
$tp->assign("numero", $i);
}
$tp->gotoBlock("_ROOT");
$tp->assign("descripcion", $descripcion);
$tp->assign("prov", $prov);
$tp->assign("local", $local);
$tp->assign("calle", $calle);
$tp->assign("ncalle", $ncalle);
$tp->assign("tel", $tel);
$tp->assign("precio", $precio);
if (isset($_SESSION['user'])) {
$tp->newBlock("reservar");
$tp->assign("idHotel", $idHotel);
}
if (!isset($_SESSION['user'])) {
$tp->newBlock("iniciarSesion");
}
echo $tp->getOutputContent();
}
示例8: savePluginFile
function savePluginFile($tplName, $fileName, $fields)
{
$pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl';
$template = new TemplatePower($pluginTpl);
$template->prepare();
if (is_array($fields)) {
foreach ($fields as $block => $data) {
$template->gotoBlock("_ROOT");
if (is_array($data)) {
foreach ($data as $rowId => $row) {
$template->newBlock($block);
foreach ($row as $key => $val) {
$template->assign($key, $val);
}
}
} else {
$template->assign($block, $data);
}
}
}
$content = $template->getOutputContent();
$iSize = file_put_contents($fileName, $content);
return $iSize;
}
示例9: createPropelClasses
/**
* DEPRECATED createPropelClasses()
*
* Don't use this method, it was left only for backward compatibility
* for some external plugins that still is using it
*/
public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection = 'workflow')
{
try {
/* $aUID = array('FLD_NAME' => 'PM_UNIQUE_ID',
'FLD_TYPE' => 'INT',
'FLD_KEY' => 'on',
'FLD_SIZE' => '11',
'FLD_NULL' => '',
'FLD_AUTO_INCREMENT' => 'on');
array_unshift($aFields, $aUID); */
$aTypes = array(
'VARCHAR' => 'string',
'TEXT' => 'string',
'DATE' => 'int',
'INT' => 'int',
'FLOAT' => 'double'
);
$aCreoleTypes = array(
'VARCHAR' => 'VARCHAR',
'TEXT' => 'LONGVARCHAR',
'DATE' => 'TIMESTAMP',
'INT' => 'INTEGER',
'FLOAT' => 'DOUBLE'
);
if ($sClassName == '') {
$sClassName = $this->getPHPName($sTableName);
}
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
if (!file_exists($sPath)) {
G::mk_dir($sPath);
}
if (!file_exists($sPath . 'map')) {
G::mk_dir($sPath . 'map');
}
if (!file_exists($sPath . 'om')) {
G::mk_dir($sPath . 'om');
}
$aData = array();
$aData['pathClasses'] = substr(PATH_DB, 0, -1);
$aData['tableName'] = $sTableName;
$aData['className'] = $sClassName;
$aData['connection'] = $connection;
$aData['GUID'] = $sAddTabUid;
$aData['firstColumn'] = isset($aFields[0])
? strtoupper($aFields[0]['FLD_NAME'])
: ($aFields[1]['FLD_NAME']);
$aData['totalColumns'] = count($aFields);
$aData['useIdGenerator'] = 'false';
$oTP1 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'Table.tpl');
$oTP1->prepare();
$oTP1->assignGlobal($aData);
file_put_contents($sPath . $sClassName . '.php', $oTP1->getOutputContent());
$oTP2 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'TablePeer.tpl');
$oTP2->prepare();
$oTP2->assignGlobal($aData);
file_put_contents($sPath . $sClassName . 'Peer.php', $oTP2->getOutputContent());
$aColumns = array();
$aPKs = array();
$aNotPKs = array();
$i = 0;
foreach ($aFields as $iKey => $aField) {
$aField['FLD_NAME'] = strtoupper($aField['FLD_NAME']);
if ($aField['FLD_TYPE'] == 'DATE') {
$aField['FLD_NULL'] = '';
}
$aColumn = array(
'name' => $aField['FLD_NAME'],
'phpName' => $this->getPHPName($aField['FLD_NAME']),
'type' => $aTypes[$aField['FLD_TYPE']],
'creoleType' => $aCreoleTypes[$aField['FLD_TYPE']],
'notNull' => ($aField['FLD_NULL'] == 'on' ? 'true' : 'false'),
'size' => (($aField['FLD_TYPE'] == 'VARCHAR')
|| ($aField['FLD_TYPE'] == 'INT')
|| ($aField['FLD_TYPE'] == 'FLOAT') ? $aField['FLD_SIZE'] : 'null'),
'var' => strtolower($aField['FLD_NAME']),
'attribute' => (($aField['FLD_TYPE'] == 'VARCHAR')
|| ($aField['FLD_TYPE'] == 'TEXT')
|| ($aField['FLD_TYPE'] == 'DATE')
? '$' . strtolower($aField['FLD_NAME']) . " = ''"
: '$' . strtolower($aField['FLD_NAME']) . ' = 0'),
'index' => $i,
);
if ($aField['FLD_TYPE'] == 'DATE') {
$aColumn['getFunction'] = '/**
* Get the [optionally formatted] [' . $aColumn['var'] . '] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the integer unix timestamp will be returned.
* @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
* @throws PropelException - if unable to convert the date/time to timestamp.
*/
public function get' . $aColumn['phpName'] . '($format = "Y-m-d")
//.........这里部分代码省略.........
示例10: TemplatePower
<?php
//llamamos al constructor de la plantilla y la poreparamos para ser mostrada
$tplClave = new TemplatePower("plantilla/recuperar_clave.html");
$tplClave->prepare();
//primero comprobamos que el usuario NO este logeado, si esta logeado redirigimos a index.php
if (isset($_SESSION['logueado'])) {
header("Location: index.php");
exit;
}
if (isset($_GET['token'])) {
$token = $_GET['token'];
//en caso de que haya un token en la querystring gestionamos el proceso para nueva contraseña
//debemos comprobar que el toquen sea valido, sino mostramos un mensaje de error
$fecha = new DateTime(date("Y-m-d H:m:s"));
$fecha->modify("-1 day");
$query = "SELECT token, usuarios.usuario FROM usuarios_recuperar_clave, usuarios\n WHERE token='{$token}' \n AND fecha>'" . $fecha->format("Y-m-d H:m:s") . "'\n AND usuarios_recuperar_clave.idusuario = usuarios.idusuario";
$datos = mysql_fetch_assoc(mysql_query($query));
if (!$datos) {
//token invalido o no presente en la base de datos
$tplClave->newBlock("errortoken");
$tplClave->newBlock("generar_token");
} else {
//token valido
$tplClave->newBlock("nueva_clave");
//mostramos el usuario para el cual se va a asignar la nueva clave
$tplClave->assign("user", $datos['usuario']);
$tplClave->assign("token", $datos['token']);
}
} else {
//comprobamos si ha ocurrido un error durante la recepcion del formulario para generar el token
示例11: save
function save($params)
{
require_once 'classes/model/Event.php';
global $G_FORM;
$sPRO_UID = $params->pro_uid;
$sEVN_UID = $params->evn_uid;
$sDYNAFORM = $params->initDyna;
$sWS_USER = trim($params->username);
$sWS_PASS = trim($params->password);
$sWS_ROUNDROBIN = '';
$sWE_USR = '';
$xDYNA = $params->dynaform;
if ($xDYNA != '') {
$pro_uid = $params->pro_uid;
$filename = $xDYNA;
$filename = $filename . '.php';
unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename);
unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace(".php", "Post", $filename) . ".php");
}
//return $params;
G::LoadClass("system");
$pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
G::mk_dir($pathProcess, 0777);
$oEvent = new Event();
$oEvent->load($sEVN_UID);
$sTASKS = $oEvent->getEvnTasUidTo();
$oTask = new Task();
$oTask->load($sTASKS);
$tas_title = $oTask->getTasTitle();
if (G::is_https()) {
$http = 'https://';
} else {
$http = 'http://';
}
$sContent = '';
$SITE_PUBLIC_PATH = '';
if (file_exists($SITE_PUBLIC_PATH . '')) {
}
require_once 'classes/model/Dynaform.php';
$oDynaform = new Dynaform();
$aDynaform = $oDynaform->load($sDYNAFORM);
$dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE']));
$sContent = "<?php\n";
$sContent .= "global \$_DBArray;\n";
$sContent .= "if (!isset(\$_DBArray)) {\n";
$sContent .= " \$_DBArray = array();\n";
$sContent .= "}\n";
$sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n";
$sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n";
$sContent .= "\$G_PUBLISH = new Publisher;\n";
$sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n";
$sContent .= "G::RenderPage('publish', 'blank');";
file_put_contents($pathProcess . $dynTitle . '.php', $sContent);
//creating the second file, the post file who receive the post form.
$pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl';
$template = new TemplatePower($pluginTpl);
$template->prepare();
$template->assign('wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2');
$template->assign('wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload');
$template->assign('processUid', $sPRO_UID);
$template->assign('dynaformUid', $sDYNAFORM);
$template->assign('taskUid', $sTASKS);
$template->assign('wsUser', $sWS_USER);
$template->assign('wsPass', 'md5:' . md5($sWS_PASS));
$template->assign('wsRoundRobin', $sWS_ROUNDROBIN);
if ($sWE_USR == "2") {
$template->assign('USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;");
} else {
$template->assign('USR_VAR', '$USR_UID = -1;');
}
$template->assign('dynaform', $dynTitle);
$template->assign('timestamp', date('l jS \\of F Y h:i:s A'));
$template->assign('ws', SYS_SYS);
$template->assign('version', System::getVersion());
$fileName = $pathProcess . $dynTitle . 'Post.php';
file_put_contents($fileName, $template->getOutputContent());
//creating the third file, only if this wsClient.php file doesn't exists.
$fileName = $pathProcess . 'wsClient.php';
$pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php';
if (file_exists($fileName)) {
if (filesize($fileName) != filesize($pluginTpl)) {
@copy($fileName, $pathProcess . 'wsClient.php.bck');
@unlink($fileName);
$template = new TemplatePower($pluginTpl);
$template->prepare();
file_put_contents($fileName, $template->getOutputContent());
}
} else {
$template = new TemplatePower($pluginTpl);
$template->prepare();
file_put_contents($fileName, $template->getOutputContent());
}
require_once 'classes/model/Event.php';
$oEvent = new Event();
$aDataEvent = array();
$aDataEvent['EVN_UID'] = $sEVN_UID;
$aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
$aDataEvent['EVN_ACTION'] = $sDYNAFORM;
$aDataEvent['EVN_CONDITIONS'] = $sWS_USER;
$output = $oEvent->update($aDataEvent);
//.........这里部分代码省略.........
示例12: processMap
public function processMap()
{
global $G_PUBLISH;
global $G_CONTENT;
global $G_FORM;
global $G_TABLE;
global $RBAC;
G::LoadClass('processMap');
$oTemplatePower = new TemplatePower(PATH_TPL . 'processes/processes_Map.html');
$oTemplatePower->prepare();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower);
$oHeadPublisher =& headPublisher::getSingleton();
//$oHeadPublisher->addScriptfile('/jscore/processmap/core/processmap.js');
$oHeadPublisher->addScriptCode('
var maximunX = ' . processMap::getMaximunTaskX($_SESSION['PROCESS']) . ';
window.onload = function(){
var pb=leimnud.dom.capture("tag.body 0");
Pm=new processmap();
var params = "{\\"uid\\":\\"' . $_SESSION['PROCESS'] . '\\",\\"mode\\":false,\\"ct\\":false}";
// maximun x and y position
var xPos = 0;
var yPos = 0;
//obtaining the processmap object for the current process
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax",
async : false,
method: "POST",
args : "action=load&data="+params
});
oRPC.make();
var response = eval(\'(\' + oRPC.xmlhttp.responseText + \')\');
for (var i in response){
if (i==\'task\'){
elements = response[i];
for (var j in elements){
if (elements[j].uid!=undefined){
if (elements[j].position.x > xPos){
xPos = elements[j].position.x;
}
if (elements[j].position.y > yPos){
yPos = elements[j].position.y;
}
}
}
}
}
Pm.options = {
target : "pm_target",
dataServer: "../processes/processes_Ajax",
uid : "' . $_SESSION['PROCESS'] . '",
lang : "' . SYS_LANG . '",
theme : "processmaker",
size : {w:xPos+800,h:yPos+150},
images_dir: "/jscore/processmap/core/images/",
rw : false,
hideMenu : false
}
Pm.make();
oLeyendsPanel = new leimnud.module.panel();
oLeyendsPanel.options = {
size :{w:260,h:155},
position:{x:((document.body.clientWidth * 95) / 100) - ((document.body.clientWidth * 95) / 100 - (((document.body.clientWidth * 95) / 100) - 260)),y:45,center:false},
title :G_STRINGS.ID_COLOR_LEYENDS,
theme :"processmaker",
statusBar:false,
control :{resize:false,roll:false,drag:true,close:false},
fx :{modal:false,opacity:false,blinkToFront:true,fadeIn:false,drag:false}
};
oLeyendsPanel.setStyle = {
content:{overflow:"hidden"}
};
oLeyendsPanel.events = {
remove: function() {delete(oLeyendsPanel);}.extend(this)
};
oLeyendsPanel.make();
oLeyendsPanel.loader.show();
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "cases_Ajax",
args: "action=showLeyends"
});
oRPC.callback = function(rpc){
oLeyendsPanel.loader.hide();
var scs=rpc.xmlhttp.responseText.extractScript();
oLeyendsPanel.addContent(rpc.xmlhttp.responseText);
}.extend(this);
oRPC.make();
}');
G::RenderPage('publish', 'blank');
}
示例13: update
function update($aData)
{
$oConnection = Propel::getConnection(EventPeer::DATABASE_NAME);
try {
$oEvent = EventPeer::retrieveByPK($aData['EVN_UID']);
if (!is_null($oEvent)) {
//$oEvent->setProUid( $aData['PRO_UID'] );
if (isset($aData['EVN_RELATED_TO'])) {
$oEvent->setEvnRelatedTo($aData['EVN_RELATED_TO']);
if ($aData['EVN_RELATED_TO'] == 'SINGLE') {
if (isset($aData['TAS_UID']) && $aData['TAS_UID'] != '') {
$oEvent->setTasUid($aData['TAS_UID']);
}
$oEvent->setEvnTasUidTo('');
$oEvent->setEvnTasUidFrom('');
} else {
$oEvent->setTasUid('');
if (isset($aData['EVN_TAS_UID_TO'])) {
$oEvent->setEvnTasUidTo($aData['EVN_TAS_UID_TO']);
}
if (isset($aData['EVN_TAS_UID_FROM'])) {
$oEvent->setEvnTasUidFrom($aData['EVN_TAS_UID_FROM']);
}
}
}
if (isset($aData['EVN_POSX'])) {
$oEvent->setEvnPosx($aData['EVN_POSX']);
}
if (isset($aData['EVN_POSY'])) {
$oEvent->setEvnPosy($aData['EVN_POSY']);
}
if (isset($aData['EVN_TAS_ESTIMATED_DURATION'])) {
$oEvent->setEvnTasEstimatedDuration($aData['EVN_TAS_ESTIMATED_DURATION']);
}
if (isset($aData['EVN_WHEN_OCCURS'])) {
$oEvent->setEvnWhenOccurs($aData['EVN_WHEN_OCCURS']);
}
if (isset($aData['EVN_STATUS'])) {
$oEvent->setEvnStatus($aData['EVN_STATUS']);
}
if (isset($aData['EVN_WHEN'])) {
$oEvent->setEvnWhen($aData['EVN_WHEN']);
}
if (isset($aData['TRI_UID'])) {
$oEvent->setTriUid($aData['TRI_UID']);
}
if (isset($aData['EVN_TYPE'])) {
$oEvent->setEvnType($aData['EVN_TYPE']);
}
if (isset($aData['EVN_CONDITIONS'])) {
$oEvent->setEvnConditions($aData['EVN_CONDITIONS']);
}
if (isset($aData['EVN_ACTION'])) {
$oEvent->setEvnAction($aData['EVN_ACTION']);
}
//if ( isset ($aData['ENV_MAX_ATTEMPTS'] )) $oEvent->setEvnMaxAttempts( 3 );
if (isset($aData['EVN_ACTION_PARAMETERS']) && $aData['EVN_ACTION_PARAMETERS'] != 0) {
$oTP = new TemplatePower(PATH_TPL . 'events' . PATH_SEP . 'sendMessage.tpl');
$oTP->prepare();
$oTP->assign('from', 'info@processmaker.com');
$oTP->assign('subject', addslashes($aData['EVN_ACTION_PARAMETERS']['SUBJECT']));
$oTP->assign('template', $aData['EVN_ACTION_PARAMETERS']['TEMPLATE']);
$oTP->assign('timestamp', date("l jS \\of F Y h:i:s A"));
$recipientTO = implode(',', $aData['EVN_ACTION_PARAMETERS']['TO']);
$recipientCC = implode(',', $aData['EVN_ACTION_PARAMETERS']['CC']);
$recipientBCC = implode(',', $aData['EVN_ACTION_PARAMETERS']['BCC']);
$oTP->assign('TO', addslashes($recipientTO));
$oTP->assign('CC', addslashes($recipientCC));
$oTP->assign('BCC', addslashes($recipientBCC));
$sTrigger = $oTP->getOutputContent();
$oTrigger = new Triggers();
$aTrigger = $oTrigger->load($oEvent->getTriUid());
$aTrigger['TRI_WEBBOT'] = $sTrigger;
$oTrigger->update($aTrigger);
$oParameters = new StdClass();
$oParameters->hash = md5($sTrigger);
$oParameters->SUBJECT = $aData['EVN_ACTION_PARAMETERS']['SUBJECT'];
$oParameters->TO = $aData['EVN_ACTION_PARAMETERS']['TO'];
$oParameters->CC = $aData['EVN_ACTION_PARAMETERS']['CC'];
$oParameters->BCC = $aData['EVN_ACTION_PARAMETERS']['BCC'];
$oParameters->TEMPLATE = $aData['EVN_ACTION_PARAMETERS']['TEMPLATE'];
//$oParameters->TRI_UID = $sTrigger->getTriUid();
$oEvent->setEvnActionParameters(serialize($oParameters));
}
if ($oEvent->validate()) {
//start the transaction
$oConnection->begin();
if (array_key_exists('EVN_DESCRIPTION', $aData)) {
$oEvent->setEvnDescription($aData['EVN_DESCRIPTION']);
}
$iResult = $oEvent->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oEvent->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw new Exception('The registry cannot be updated!<br />' . $sMessage);
//.........这里部分代码省略.........
示例14: BaseDatos
<?php
session_start();
include "inc.includes.php";
$db = new BaseDatos($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['db']);
$tpl = new TemplatePower("templates/index.html");
$tpl->prepare();
$tpl->gotoBlock("_ROOT");
//isset determina si una variable esta definida o es null
//$_REQUEST tiene el contenido de get y post
if (!isset($_REQUEST["action"]) || $_REQUEST["action"] == "") {
$tpl->newBlock("contenido");
$mhotels = new MHotels();
$result = $mhotels->allhoteles();
if ($result['found']) {
foreach ($result['result'] as $r) {
$tpl->newblock("hotels");
$tpl->assign("idHotel", $r['id_hotel']);
$tpl->assign("name", $r['nom_hotel']);
$tpl->assign("prov", $r['provincia']);
$tpl->assign("local", $r['localidad']);
$tpl->assign("calle", $r['calle']);
$tpl->assign("ncalle", $r['nro_calle']);
$tpl->assign("tel", $r['telefono']);
$tpl->assign("precio", $r['precio_persona']);
}
} else {
$tpl->newblock("no_hotels");
}
$webapp = $tpl->getOutputContent();
} else {
示例15: TemplatePower
//inclimos los archivos de control necesarios para la clase templatepower
include_once 'clases/class.TemplatePower.inc.php';
require_once 'clases/class.phpmailer.php';
require_once 'libreria.php';
//iniciamos sesión con mysql
session_start();
//Datos para la conexion a mysql
define('DB_SERVER', 'localhost');
define('DB_NAME', 'gicorec');
define('DB_USER', 'root');
define('DB_PASS', '');
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
mysql_select_db(DB_NAME, $con);
//Inicializamos la plantilla
$tplIndex = new TemplatePower("plantilla/index.html");
$tplIndex->prepare();
//Establecemos el archivo de gestión a usar para las tareas que lo precisen
if (isset($_GET['gestion'])) {
$gestion = $_GET['gestion'];
include_once "gestion/{$gestion}.php";
} elseif (isset($_GET['ajax'])) {
//peticiones ajax que recibimos.
$filePath = "ajax/" . $_GET['ajax'] . ".php";
if (is_file($filePath)) {
include_once "{$filePath}";
exit;
}
//para el caso en el que se necesite crear el pdf
} elseif (isset($_GET['imprimir'])) {
include_once "imprimir.php";
} else {