コード例 #1
0
 public function getHTML($small = false)
 {
     global $install, $sql;
     include_once "HTML/Template/Flexy.php";
     $config = new Configuracion($sql);
     $this->data->TITLE = $config->get("Nombre del Sitio");
     $map = $config->get("Coordenadas del Mapa");
     $marker = $config->get("Coordenadas del Marcador");
     if ($map) {
         $map = split(",", $map);
         $this->data->MAP = "<script>\nvar lat = " . $map[0] . ";\nvar lon = " . $map[1] . ";\n</script>";
     }
     if ($marker) {
         $marker = split(",", $marker);
         $this->data->MARKER = "<script>\nvar latMarker = " . $marker[0] . ";\nvar lonMarker = " . $marker[1] . ";\n</script>";
     }
     $options = array('compileDir' => $install . '/tmp', 'templateDir' => $install . '/template');
     if ($small) {
         $template = "content.small.html";
     } else {
         $template = $this->data->data["TEMPLATECON"];
         $cursor = $sql->readDB("TEMPLATE", "ID______TEM={$template}");
         $res = $cursor->fetch_assoc();
         $template = $res["FILE____TEM"];
     }
     $output = new HTML_Template_Flexy($options);
     $output->compile($template);
     return $output->bufferedOutputObject($this->data);
 }
コード例 #2
0
ファイル: Flexy.php プロジェクト: nishimura/laiz
 /**
  * テンプレートの設定
  * @param $templateName
  * @access private
  */
 protected function setVariables($templateName, $obj)
 {
     // Hidden値の設定
     // Flexyを生成する前に $this->_hidden に値を代入しておく
     // Flexyから $this->_hidden が利用される
     $hidden = Container::getInstance()->getComponent('Laiz_Action_Component_Hidden');
     if ($hidden instanceof Laiz_Action_Component_Hidden) {
         foreach ($hidden->getHiddens() as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $hiddenName => $hiddenValue) {
                     $this->setHidden($key, $hiddenName, $hiddenValue);
                 }
             }
         }
     }
     $options = array('templateDir' => $this->TEMPLATE_DIR, 'multiSource' => true, 'compileDir' => $this->FLEXY_COMPILE_DIR, 'numberFormat' => ', 0', 'forceCompile' => $this->FLEXY_FORCE_COMPILE);
     // ユーザ独自の設定
     if ($this->_flexyOptions) {
         $options = array_merge($options, $this->_flexyOptions);
     }
     $rep = error_reporting();
     error_reporting($rep & E_ALL);
     // PEARの関係上Strictエラーを除外する
     $this->flexy = new Fly_Flexy($options);
     // Hidden値の設定
     //$this->flexy->setHiddens($this->_hiddens);
     $this->flexy->compile($templateName);
     $this->_elements = $this->flexy->getElements();
     error_reporting($rep);
     $this->_setVariables($obj);
     $this->_obj = $obj;
 }
コード例 #3
0
ファイル: test.php プロジェクト: ranvis/HTML_Template_Flexy
function compileAll($options, $files = array())
{
    // loop through
    $dh = opendir(dirname(__FILE__) . '/templates/');
    while (false !== ($file = readdir($dh))) {
        if ($file[0] == '.') {
            continue;
        }
        if (is_dir(dirname(__FILE__) . '/templates/' . $file)) {
            continue;
        }
        // skip if not listed in files (and it's an array)
        if ($files && !in_array($file, $files)) {
            continue;
        }
        $x = new HTML_Template_Flexy($options);
        echo "compile  {$file} \n";
        $res = $x->compile($file);
        if ($res !== true) {
            echo "Compile failure: " . $res->toString() . "\n";
        }
    }
}
コード例 #4
0
function compilefile($file, $data = array(), $options = array(), $elements = array())
{
    $options = $options + array('templateDir' => dirname(__FILE__) . '/templates', 'forceCompile' => true, 'fatalError' => HTML_TEMPLATE_FLEXY_ERROR_RETURN, 'url_rewrite' => 'images/:/myproject/images/', 'compileDir' => dirname(__FILE__) . '/results1');
    // basic options..
    echo "\n\n===Compiling {$file}===\n\n";
    $options['compileDir'] = dirname(__FILE__) . '/results1';
    $x = new HTML_Template_Flexy($options);
    $res = $x->compile($file);
    if ($res !== true) {
        echo "===Compile failure==\n" . $res->toString() . "\n";
        return;
    }
    echo "\n\n===Compiled file: {$file}===\n";
    echo file_get_contents($x->compiledTemplate);
    if (!empty($options['show_elements'])) {
        print_r($x->getElements());
    }
    if (!empty($options['show_words'])) {
        print_r(unserialize(file_get_contents($x->gettextStringsFile)));
    }
    echo "\n\n===With data file: {$file}===\n";
    $data = (object) $data;
    $x->outputObject($data, $elements);
}
コード例 #5
0
ファイル: Preview.php プロジェクト: roojs/Pman.Builder
 function outputBody()
 {
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - start');
     }
     $ff = HTML_FlexyFramework::get();
     $proj = $ff->project;
     // DB_DataObject::debugLevel(1);
     $m = DB_DAtaObject::factory('Builder_modules');
     $m->get('name', $proj);
     //var_dump($m->path);exit;
     // needs to modify the template directory??
     // use the builder_module == app name
     // look for part with same name.
     if (empty($ff->Pman_Builder['from_filesystem'])) {
         $template_engine = new HTML_Template_Flexy(array('templateDir' => $m->path));
     } else {
         $template_engine = new HTML_Template_Flexy();
     }
     $template_engine->debug = 1;
     //print_R($template_engine);
     $template_engine->compile($this->template);
     if ($this->elements) {
         /* BC crap! */
         $this->elements = HTML_Template_Flexy_Factory::setErrors($this->elements, $this->errors);
     }
     $template_engine->elements = $this->elements;
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - render template');
     }
     //DB_DataObject::debugLevel(1);
     $template_engine->outputObject($this, $this->elements);
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - end');
     }
 }
コード例 #6
0
    $appendName = "";
    if (isset($_REQUEST['estado'])) {
        if ($_REQUEST['estado'] != 0) {
            $appendName .= "[" . $tpl->ESTADOS[$_REQUEST['estado']]['label'] . "]";
        }
    }
    if (isset($_REQUEST['local'])) {
        if ($_REQUEST['local'] != 0) {
            $appendName .= "[" . $tpl->LOCALES[$_REQUEST['local']]['label'] . "]";
        }
    }
    $doc->getActiveSheet()->fromArray($xls, null, 'A1');
    $doc->getActiveSheet()->getStyle('I1:I100')->getNumberFormat()->setFormatCode('[green]$#,##0;[red]$#,##0');
    $doc->getActiveSheet()->getStyle('D1:D100')->getNumberFormat()->setFormatCode('$#,##0');
    foreach (range('A', 'I') as $columnID) {
        $doc->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
    }
    $doc->getActiveSheet()->freezePane("B2");
    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment;filename="ventas-' . date("d/m/Y") . $appendName . '.xls"');
    header('Cache-Control: max-age=0');
    // Do your stuff here
    $writer = PHPExcel_IOFactory::createWriter($doc, 'Excel5');
    $writer->save('php://output');
    exit;
}
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("ventas.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
コード例 #7
0
ファイル: Translator.php プロジェクト: q32p/emst
 /**
  * output the default template with the editing facilities.
  * 
  * @return   none
  * @access   public
  */
 function outputDefaultTemplate()
 {
     $o = array('compileDir' => ini_get('session.save_path') . '/HTML_Template_Flexy_Translate', 'templateDir' => dirname(__FILE__) . '/templates');
     $x = new HTML_Template_Flexy($o);
     $x->compile('translator.html');
     $x->outputObject($this);
 }
コード例 #8
0
if ($cursor && $cursor->num_rows > 0) {
    while ($row = $cursor->fetch_assoc()) {
        $result[$row['LOCAL']][$row['FECHA']] = (int) $row['TOTAL'];
    }
}
$tmp = array();
foreach ($result as $k => $v) {
    foreach ($v as $kk => $vv) {
        $tmp[$kk][$k] = $vv;
    }
}
foreach ($tmp as $k => $v) {
    $row = array($k);
    foreach ($v as $kk => $vv) {
        for ($i = 1; $i < count($val[0]); $i++) {
            $row[$i] = 0;
            if ($kk == $val[0][$i]) {
                $row[$i] = (int) $vv;
            }
        }
    }
    $val[] = $row;
}
//print_r($val);exit;
$tpl->variablesJavascript .= "var ventas = eval('(" . json_encode($val) . ")');\n";
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("local.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
コード例 #9
0
$cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'");
while ($row = $cursor->fetch_assoc()) {
    if (url_slug($row['TITULO__CON']) == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
    if ("contenido=" . $row["ID______CON"] == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
}
$cursor = $sql->readDB("CATEGORIA");
while ($row = $cursor->fetch_assoc()) {
    if (url_slug($row['NOMBRE__CAT']) == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
}
if (!$error) {
    Header("HTTP/1.0 200 OK");
    $_REQUEST['bufferedHTML'] = true;
    $_REQUEST['what'] = substr($_SERVER['REQUEST_URI'], 1);
    include_once "getContent.php";
    $content = $retval['html'];
    $content .= "<script>var error = true; var passedURL = '" . substr($_SERVER['REQUEST_URI'], 1) . "';</script>";
    include_once "container.php";
    exit;
}
$options = array('templateDir' => $install . "/template", 'compileDir' => $install . "/tmp");
$object = new HTML_Template_Flexy($options);
$object->compile("error.html");
$content = $object->bufferedOutputObject($tpl);
$content .= "<script>var error = true; var passedURL = 'home';</script>";
include_once "container.php";
コード例 #10
0
<?php

$tpl = new stdClass();
include_once "common.php";
require_once "HTML/Template/Flexy.php";
include_once "sesion.php";
$table = "RESERVA";
$tpl->variablesJavascript = "<script type='text/javascript'>";
$local = $_SESSION['local'];
$tpl->variablesJavascript .= "var local = '" . $local . "';\n";
$tpl->MAPA = "";
$cursor = $sql->readDB("LOCAL", "CODIGO__LOC='{$local}'");
if ($cursor && $cursor->num_rows > 0) {
    if ($data = $cursor->fetch_assoc()) {
        $tpl->MAPA = $data['PLANO___LOC'];
    }
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("selecciona-mesa.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
コード例 #11
0
function getInputWidget($key, $value = "", $type = "text")
{
    global $sql;
    $retval = '';
    preg_match('/[a-zA-Z]+/', $type, $matches);
    preg_match('/\\[[_\\|\\=a-zA-Z0-9]+\\]/', $type, $options);
    if ($options) {
        $options = str_replace(array('[', ']'), '', $options[0]);
        $tmp = explode("|", $options);
        unset($options);
        foreach ($tmp as $v) {
            $tmp = explode("=", $v);
            $options[$tmp[1]] = $tmp[0];
        }
    }
    switch ($matches[0]) {
        case 'radio':
            foreach ($options as $k => $v) {
                if ($k != '_bootstrap') {
                    $retval .= "<label class='radio inline'>";
                    if ($k == $value) {
                        $retval .= "<input type='radio' name='{$key}' value='{$k}' checked='checked'>{$v}";
                    } else {
                        $retval .= "<input type='radio' name='{$key}' value='{$k}'>{$v}";
                    }
                    $retval .= "</label>";
                }
            }
            break;
        case 'dbcombobox':
            foreach ($options as $k => $v) {
                $ref[$v] = $k;
            }
            $retval .= "<select name='{$key}' value='{$value}'>";
            $query = "SELECT * FROM " . $ref['TABLE'] . ";";
            $result = $sql->con->query($query);
            while ($row = $result->fetch_assoc()) {
                if ($value == $row[$ref['INDEX']]) {
                    $retval .= "\t<option value='" . $row[$ref['INDEX']] . "' selected>" . $row[$ref['LABEL']] . "</option>";
                } else {
                    $retval .= "\t<option value='" . $row[$ref['INDEX']] . "'>" . $row[$ref['LABEL']] . "</option>";
                }
            }
            $retval .= "</select>";
            break;
        case 'textarea':
            if ($options) {
                foreach ($options as $k => $v) {
                    $configs[$v] = $k;
                }
                $cols = $configs['cols'];
                $rows = $configs['rows'];
                $retval .= "<textarea name='{$key}' cols='{$cols}' rows='{$rows}'>";
            } else {
                $retval .= "<textarea name='{$key}'>";
            }
            $retval .= "{$value}</textarea>";
            break;
        case 'tinyMCE':
            $retval = "<textarea id='{$key}' name='{$key}'>{$value}</textarea>";
            $retval .= "<script src=\"//tinymce.cachefly.net/4.1/tinymce.min.js\"></script>";
            $retval .= "<script>tinymce.init({selector:'#{$key}'});</script>";
            break;
        case 'file':
            if (empty($value)) {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/NoDisponible.jpg\" alt=\"Preview\">";
            } else {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/{$value}\" alt=\"Preview\">";
            }
            $retval .= "<input type='{$type}' name='" . $key . "_file' value='{$value}' onchange='previewImage(this)' width='200'>";
            $retval .= "<input type='hidden' name='{$key}' value='{$value}'>";
            break;
        case 'multifile':
            include_once "HTML/Template/Flexy.php";
            $options = array('templateDir' => "inputWidgets/templates", 'compileDir' => "inputWidgets/templates");
            $obj = new stdClass();
            $obj->KEY = $key;
            $obj->JAVASCRIPT = "<script>var key = '" . $key . "'</script>";
            $tmp = unserialize($value);
            if (is_array($tmp)) {
                foreach ($tmp as $tk => $tv) {
                    $obj->FILAS[]['nombre'] = $tv;
                }
            }
            $output = new HTML_Template_Flexy($options);
            $output->compile('multifile.html');
            $retval = $output->bufferedOutputObject($obj);
            break;
        default:
            $retval = "<input type='{$type}' name='{$key}' value='{$value}'>";
            break;
    }
    return $retval;
}
コード例 #12
0
ファイル: ic2_setter.php プロジェクト: nyarla/fluxflex-rep2ex
                continue;
            }
            $file = ic2_check_uploaded_file($path, $name, $type, $filesize, $tmpname, $errcode);
            if (is_array($file)) {
                $upfiles[] = $file;
            } else {
                P2Util::pushInfoHtml($file);
            }
        }
    }
}
// }}}
// {{{ output
$_flexy_options = array('locale' => 'ja', 'charset' => 'Shift_JIS', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ic2/templates', 'numberFormat' => '');
$flexy = new HTML_Template_Flexy($_flexy_options);
$flexy->compile('ic2s.tpl.html');
if (!$isPopUp && (!empty($upfiles) || P2Util::hasInfoHtml())) {
    $showForm = false;
} else {
    $showForm = true;
}
// フォームを修正
$elements = $flexy->getElements();
if ($showForm) {
    $form_attr = array('action' => $_SERVER['SCRIPT_NAME'] . '?upload=1', 'accept-charset' => $_conf['accept_charset']);
    $elements['fileupload']->setAttributes($form_attr);
    $elements['MAX_FILE_SIZE']->setValue($maxsize);
    $elements['popup']->setValue($isPopUp);
    if ($isPopUp) {
        $elements['fileupload']->setAttributes('target="_self"');
    } else {
コード例 #13
0
include_once "sesion.php";
$table = "PEDIDO";
$local = $_SESSION['local'];
if (isset($_REQUEST['pedido'])) {
    $pedido = $sql->con->real_escape_string($_REQUEST['pedido']);
    $cursor = $sql->con->query("SELECT * FROM PEDIDO LEFT JOIN RESERVA ON RESERVA_PED=CODIGO__RES WHERE NUMERO__PED='{$pedido}'");
    if ($cursor && $cursor->num_rows > 0) {
        if ($reserva = $cursor->fetch_assoc()) {
            $cant = 1;
            if (empty($reserva['CODIGO__RES'])) {
                $tpl->NEW = true;
            } else {
                $subcursor = $sql->con->query("SELECT * FROM DETALLE_PEDIDO LEFT JOIN PLATO ON PLATO___DEP=CODIGO__PLA WHERE PEDIDO__DEP='" . $reserva['NUMERO__PED'] . "'");
                if ($subcursor && $subcursor->num_rows > 0) {
                    while ($row = $subcursor->fetch_assoc()) {
                        $row['VALOR___PLA'] = "\$" . number_format($row['VALOR___PLA'] * $row['CANTIDADDEP'], 0, ',', '.');
                        $tpl->PLATOS[] = $row;
                    }
                }
            }
            $reserva['FECHA___RES'] = date("d/m/Y H:i", strtotime($reserva['FECHA___RES']));
            $tpl->pagada = true;
            $tpl->RESERVA = $reserva;
        }
    }
}
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("pedido.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
コード例 #14
0
                                if (!$sql->addDB("INSUMO", $insert)) {
                                    print_r($sql->con);
                                    exit('Error');
                                }
                                $exitos[] = "Se agregó el insumo " . $insert['NOMBRE__INS'] . ".";
                                $sc = $sql->readDB("LOCAL");
                                if ($sc && $sc->num_rows > 0) {
                                    while ($r = $sc->fetch_assoc()) {
                                        if ($r['CODIGO__LOC'] == $local) {
                                            $insloc = array("INSUMO__ILC" => $value['codigo'], "LOCAL___ILC" => $r['CODIGO__LOC'], "CANTIDADILC" => $value['cantidad']);
                                        } else {
                                            $insloc = array("INSUMO__ILC" => $value['codigo'], "LOCAL___ILC" => $r['CODIGO__LOC'], "CANTIDADILC" => 0);
                                        }
                                        $sql->addDB("INSUMO_LOCAL", $insloc);
                                    }
                                }
                            }
                        }
                    }
                }
                $tpl->EXITOS = $exitos;
                $tpl->ERRORES = $errores;
            }
            break;
    }
}
$options = array('templateDir' => 'templates', 'compileDir' => 'tmp');
$output = new HTML_Template_Flexy($options);
$output->compile("excel.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
require_once "container.php";
コード例 #15
0
<?php

/* Mini test suite */
require_once 'HTML/Template/Flexy.php';
//print_r($_SERVER['argv']);
if (!isset($_SERVER['argv'][1])) {
    $files = array(dirname(__FILE__) . '/index.tpl');
} else {
    $files = $_SERVER['argv'];
    array_shift($files);
}
//print_r($files);
foreach ($files as $file) {
    $dir = dirname($file);
    $x = new HTML_Template_Flexy(array('compileDir' => dirname(__FILE__), 'templateDir' => $dir, 'locale' => 'en', 'forceCompile' => true, 'debug' => false, 'nonHTML' => false, 'allowPHP' => false, 'compiler' => 'SmartyConvertor', 'compileToString' => true, 'filters' => array(), 'numberFormat' => ",2,'.',','", 'flexyIgnore' => 0));
    echo $x->compile(basename($file));
}
コード例 #16
0
if (isset($_REQUEST['reserva']) && !empty($_REQUEST['reserva'])) {
    $reserva = $sql->con->real_escape_string($_REQUEST['reserva']);
    $cursor = $sql->readDB("RESERVA LEFT JOIN PEDIDO ON RESERVA_PED=CODIGO__RES LEFT JOIN MESA ON ID______MES=MESA____RES", "CODIGO__RES='{$reserva}'");
    if ($cursor && $cursor->num_rows > 0) {
        if ($orden = $cursor->fetch_assoc()) {
            $data = array("ESTADO__PED" => 6);
            if ($sql->updateDB("PEDIDO", $data, "NUMERO__PED='" . $orden['NUMERO__PED'] . "'")) {
                $orden['fecha'] = date('d/m/Y H:i:s');
                $subcursor = $sql->readDB("DETALLE_PEDIDO LEFT JOIN PLATO ON PLATO___DEP=CODIGO__PLA", "PEDIDO__DEP='" . $orden['NUMERO__PED'] . "' AND ESTADO__DEP='S'");
                if ($subcursor && $subcursor->num_rows > 0) {
                    $total = 0;
                    while ($row = $subcursor->fetch_assoc()) {
                        $total += $row['CANTIDADDEP'] * $row['VALOR___PLA'];
                        $tpl->DETAILS[] = array("plato" => strtoupper($row['DESCRIPCPLA']), "cantidad" => $row['CANTIDADDEP'], "valor" => "\$" . number_format($row['CANTIDADDEP'] * $row['VALOR___PLA'], 0, ',', '.'));
                    }
                    $tpl->TOTAL = "\$" . number_format($total, 0, ',', '.');
                    $tpl->PROPINA = "\$" . number_format(ceil($total / 10), 0, ',', '.');
                    $tpl->TOTAL_FINAL = "\$" . number_format($total * 1.1, 0, ',', '.');
                }
                foreach ($orden as $k => $v) {
                    $orden[$k] = strtoupper($v);
                }
                $tpl->ORDER = $orden;
            }
        }
    }
}
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("cuenta.html");
$output->outputObject($tpl);
コード例 #17
0
            foreach ($options as $k => $v) {
                $ref[$v] = $k;
            }
            $query = "SELECT * FROM " . $ref['TABLE'] . " WHERE " . $ref['INDEX'] . "='" . $value . "';";
            $cursor = $sql->query($query);
            while ($row = $cursor->fetch_assoc()) {
                $retval = $row[$ref['LABEL']];
            }
            break;
        case 'thumb':
            if (empty($value)) {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/100/100/crop/NoDisponible.jpg\" alt=\"Preview\">";
            } else {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/100/100/crop/{$value}\" alt=\"Preview\">";
            }
            break;
        default:
            $retval = $value;
            break;
    }
    //*/
    return $retval;
}
$bread[count($bread) - 1]['active'] = true;
$bread[count($bread) - 1]['link'] = false;
$tpl->BREAD = $bread;
$options = array('templateDir' => 'templates', 'compileDir' => 'tmp');
$output = new HTML_Template_Flexy($options);
$output->compile("insumos.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
コード例 #18
0
        /*
        		if( preg_match_all('/(Firefox|Chrome|Opera|Safari)/',$row['BROWSER_AUD'],$matches) ){
        			$browser = $matches[0][0];
        		} else {
        			if(preg_match_all('/MSIE/',$row['BROWSER_AUD'])){
        				$browser = "Internet Explorer";
        			}
        		}
        		//*/
        if (isset($browser)) {
            $set = true;
            foreach ($val as $k => $v) {
                if ($v[0] == $browser) {
                    $v[1] += $row['CANT'];
                    $val[$k] = $v;
                    $set = false;
                }
            }
            if ($set) {
                $val[] = array($browser, (int) $row['CANT']);
            }
        }
        //*/
    }
}
$tpl->NAVEGADOR = "<script>var navegador = eval('(" . json_encode($val) . ")');</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("home.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
コード例 #19
0
        $cursor = $sql->con->query($q = "SELECT * FROM INSUMOS_PLATO LEFT JOIN INSUMO_LOCAL ON INSUMO__ILC=INSUMO__IPL WHERE PLATO___IPL='{$plato}' AND LOCAL___ILC='{$local}'");
        if ($cursor && $cursor->num_rows > 0) {
            while ($row = $cursor->fetch_assoc()) {
                $upData = array("INSUMO__ILC" => $row['INSUMO__ILC'], "CANTIDADILC" => (int) $row['CANTIDADILC'] - (int) $row['CANTIDADIPL']);
                $sql->updateDB("INSUMO_LOCAL", $upData, "ID______ILC='" . $row['ID______ILC'] . "'");
            }
        }
        header('Location: cola-pedidos');
    }
}
if (isset($_REQUEST['cancelar'])) {
    $detalle_pedido = $sql->con->real_escape_string($_REQUEST['cancelar']);
    $data = array("ESTADO__DEP" => 'P');
    if (!$sql->updateDB("DETALLE_PEDIDO", $data, "ID______DEP='" . $detalle_pedido . "'")) {
    } else {
        header('Location: cola-pedidos');
    }
}
$cursor = $sql->con->query("SELECT * FROM DETALLE_PEDIDO LEFT JOIN PLATO ON PLATO___DEP=CODIGO__PLA LEFT JOIN PEDIDO ON PEDIDO__DEP=NUMERO__PED WHERE PEDIDO__DEP IN (SELECT NUMERO__PED FROM PEDIDO WHERE RESERVA_PED IN (SELECT CODIGO__RES FROM RESERVA WHERE MESA____RES IN (SELECT ID______MES FROM MESA WHERE LOCAL___MES='" . $local . "'))) AND (ESTADO__DEP='P' OR ESTADO__DEP='L' OR ESTADO__DEP='D')");
if ($cursor && $cursor->num_rows > 0) {
    while ($row = $cursor->fetch_assoc()) {
        if ($row['ESTADO__PED'] < 6 && $row['ESTADO__DEP'] != 'L') {
            $tpl->pendiente[] = $row;
        }
    }
}
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("cola-pedidos.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
コード例 #20
0
ファイル: Flexy.php プロジェクト: altesien/FinalProject
 /**
  * static version which does new, compile and output all in one go.
  *
  *   See outputObject($t) for more details.
  *
  *   @version    01/12/14
  *   @access     public
  *   @author     Alan Knowles
  *   @param      object object to output as $t
  *   @param      filename of template
  *   @return     string - result
  */
 function &staticQuickTemplate($file, &$t)
 {
     $template = new HTML_Template_Flexy();
     $template->compile($file);
     $template->outputObject($t);
 }
コード例 #21
0
ファイル: ic2_manager.php プロジェクト: xingskycn/p2-php
}
// }}}
// {{{ 出力
$flexy->setData('skin', $skin_en);
$flexy->setData('php_self', $_SERVER['SCRIPT_NAME']);
$flexy->setData('p2vid', P2_VERSION_ID);
$flexy->setData('info_msg', P2Util::getInfoHtml());
$flexy->setData('pc', !$_conf['ktai']);
$flexy->setData('iphone', $_conf['iphone']);
$flexy->setData('doctype', $_conf['doctype']);
$flexy->setData('extra_headers', $_conf['extra_headers_ht']);
$flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
if ($db->dsn['phptype'] == 'sqlite' || $viewer_cache_exists) {
    $flexy->setData('enable_optimize_db', true);
} else {
    $flexy->setData('enable_optimize_db', false);
}
P2Util::header_nocache();
$flexy->compile('ic2mng.tpl.html');
$flexy->output();
// }}}
/*
 * Local Variables:
 * mode: php
 * coding: cp932
 * tab-width: 4
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 */
// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker:
コード例 #22
0
 function display()
 {
     $output = new HTML_Template_Flexy(array('templateDir' => MAX_PATH . '/lib/max/Admin/Inventory/themes', 'compileDir' => MAX_PATH . '/var/templates_compiled', 'flexyIgnore' => true));
     $codes = $this->codes;
     $this->codes = array();
     if (is_array($codes)) {
         foreach ($codes as $v) {
             $k = count($this->codes);
             $v['id'] = "tag_{$k}";
             $v['name'] = "tag[{$k}]";
             $v['autotrackname'] = "autotrack[{$k}]";
             $v['autotrack'] = isset($v['autotrack']) ? $v['autotrack'] : false;
             $v['rank'] = $k + 1;
             $v['move_up'] = $k > 0;
             $v['move_down'] = $k < count($codes) - 1;
             $this->codes[] = $v;
         }
     }
     // Display page content
     $output->compile('TrackerAppend.html');
     $output->outputObject($this);
 }
コード例 #23
0
ファイル: ic2.php プロジェクト: nyarla/fluxflex-rep2ex
function ic2_display($path, $params)
{
    global $_conf, $ini, $thumb, $dpr, $redirect, $id, $uri, $file, $thumbnailer;
    if (P2_OS_WINDOWS) {
        $path = str_replace('\\', '/', $path);
    }
    if (strncmp($path, '/', 1) == 0) {
        $s = empty($_SERVER['HTTPS']) ? '' : 's';
        $to = 'http' . $s . '://' . $_SERVER['HTTP_HOST'] . $path;
    } else {
        $dir = dirname(P2Util::getMyUrl());
        if (strncasecmp($path, './', 2) == 0) {
            $to = $dir . substr($path, 1);
        } elseif (strncasecmp($path, '../', 3) == 0) {
            $to = dirname($dir) . substr($path, 2);
        } else {
            $to = $dir . '/' . $path;
        }
    }
    $name = basename($path);
    $ext = strrchr($name, '.');
    switch ($redirect) {
        case 1:
            header("Location: {$to}");
            exit;
        case 2:
            switch ($ext) {
                case '.jpg':
                    header("Content-Type: image/jpeg; name=\"{$name}\"");
                    break;
                case '.png':
                    header("Content-Type: image/png; name=\"{$name}\"");
                    break;
                case '.gif':
                    header("Content-Type: image/gif; name=\"{$name}\"");
                    break;
                default:
                    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
                        header("Content-Type: application/octetstream; name=\"{$name}\"");
                    } else {
                        header("Content-Type: application/octet-stream; name=\"{$name}\"");
                    }
            }
            header("Content-Disposition: inline; filename=\"{$name}\"");
            header('Content-Length: ' . filesize($path));
            readfile($path);
            exit;
        default:
            if (!class_exists('HTML_Template_Flexy', false)) {
                require 'HTML/Template/Flexy.php';
            }
            if (!class_exists('HTML_QuickForm', false)) {
                require 'HTML/QuickForm.php';
            }
            if (!class_exists('HTML_QuickForm_Renderer_ObjectFlexy', false)) {
                require 'HTML/QuickForm/Renderer/ObjectFlexy.php';
            }
            if (isset($uri)) {
                $img_o = 'uri';
                $img_p = $uri;
            } elseif (isset($id)) {
                $img_o = 'id';
                $img_p = $id;
            } else {
                $img_o = 'file';
                $img_p = $file;
            }
            $img_q = $img_o . '=' . rawurlencode($img_p);
            // QuickFormの初期化
            $_size = explode('x', $thumbnailer->calc($params['width'], $params['height']));
            $_constants = array('o' => sprintf('原寸 (%dx%d)', $params['width'], $params['height']), 's' => '作成', 't' => $thumb, 'd' => $dpr, 'u' => $img_p, 'v' => $img_o, 'x' => $_size[0], 'y' => $_size[1]);
            $_defaults = array('q' => $ini["Thumb{$thumb}"]['quality'], 'r' => '0');
            $mobile = Net_UserAgent_Mobile::singleton();
            $qa = 'size=3 maxlength=3';
            if ($mobile->isDoCoMo()) {
                $qa .= ' istyle=4';
            } elseif ($mobile->isEZweb()) {
                $qa .= ' format=*N';
            } elseif ($mobile->isSoftBank()) {
                $qa .= ' mode=numeric';
            }
            $_presets = array('' => 'サイズ・品質');
            foreach ($ini['Dynamic']['presets'] as $_preset_name => $_preset_params) {
                $_presets[$_preset_name] = $_preset_name;
            }
            $qf = new HTML_QuickForm('imgmaker', 'get', 'ic2_mkthumb.php');
            $qf->setConstants($_constants);
            $qf->setDefaults($_defaults);
            $qf->addElement('hidden', 't');
            $qf->addElement('hidden', 'u');
            $qf->addElement('hidden', 'v');
            $qf->addElement('text', 'x', '高さ', $qa);
            $qf->addElement('text', 'y', '横幅', $qa);
            $qf->addElement('text', 'q', '品質', $qa);
            $qf->addElement('select', 'p', 'プリセット', $_presets);
            $qf->addElement('select', 'r', '回転', array('0' => 'なし', '90' => '右に90°', '270' => '左に90°', '180' => '180°'));
            $qf->addElement('checkbox', 'w', 'トリム');
            $qf->addElement('checkbox', 'z', 'DL');
            $qf->addElement('submit', 's');
            $qf->addElement('submit', 'o');
            // FlexyとQurickForm_Rendererの初期化
            $_flexy_options = array('locale' => 'ja', 'charset' => 'cp932', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ic2/templates', 'numberFormat' => '');
            $flexy = new HTML_Template_Flexy($_flexy_options);
            $rdr = new HTML_QuickForm_Renderer_ObjectFlexy($flexy);
            $qf->accept($rdr);
            // 表示
            $flexy->setData('p2vid', P2_VERSION_ID);
            $flexy->setData('title', 'IC2::Cached');
            $flexy->setData('pc', !$_conf['ktai']);
            $flexy->setData('iphone', $_conf['iphone']);
            if (!$_conf['ktai']) {
                $flexy->setData('skin', $GLOBALS['skin_name']);
                //$flexy->setData('stylesheets', array('css'));
                //$flexy->setData('javascripts', array('js'));
            } else {
                $flexy->setData('k_color', array('c_bgcolor' => !empty($_conf['mobile.background_color']) ? $_conf['mobile.background_color'] : '#ffffff', 'c_text' => !empty($_conf['mobile.text_color']) ? $_conf['mobile.text_color'] : '#000000', 'c_link' => !empty($_conf['mobile.link_color']) ? $_conf['mobile.link_color'] : '#0000ff', 'c_vlink' => !empty($_conf['mobile.vlink_color']) ? $_conf['mobile.vlink_color'] : '#9900ff'));
            }
            $rank = isset($params['rank']) ? $params['rank'] : 0;
            if ($_conf['iphone']) {
                $img_dir = 'img/iphone/';
                $img_ext = '.png';
            } else {
                $img_dir = 'img/';
                $img_ext = $_conf['ktai'] ? '.gif' : '.png';
            }
            $stars = array();
            $stars[-1] = $img_dir . ($rank == -1 ? 'sn1' : 'sn0') . $img_ext;
            //$stars[0] = $img_dir . (($rank ==  0) ? 'sz1' : 'sz0') . $img_ext;
            $stars[0] = $img_dir . ($_conf['iphone'] ? 'sz0' : 'sz1') . $img_ext;
            for ($i = 1; $i <= 5; $i++) {
                $stars[$i] = $img_dir . ($rank >= $i ? 's1' : 's0') . $img_ext;
            }
            $k_at_a = str_replace('&amp;', '&', $_conf['k_at_a']);
            $setrank_url = "ic2.php?{$img_q}&t={$thumb}&r=0{$k_at_a}";
            $flexy->setData('stars', $stars);
            $flexy->setData('params', $params);
            if ($thumb == 2 && $rank >= 0) {
                if ($ini['General']['inline'] == 1) {
                    $t = 2;
                    $link = null;
                } else {
                    $t = 1;
                    $link = $path;
                }
                $r = $ini['General']['redirect'] == 1 ? 1 : 2;
                $preview = "{$_SERVER['SCRIPT_NAME']}?o=1&r={$r}&t={$t}&{$img_q}{$k_at_a}";
                $flexy->setData('preview', $preview);
                $flexy->setData('link', $link);
                $flexy->setData('info', null);
            } else {
                $flexy->setData('preview', null);
                $flexy->setData('link', $path);
                $flexy->setData('info', null);
            }
            if (!$_conf['ktai'] || $_conf['iphone']) {
                $flexy->setData('backto', null);
            } elseif (isset($_REQUEST['from'])) {
                $flexy->setData('backto', $_REQUEST['from']);
                $setrank_url .= '&from=' . rawurlencode($_REQUEST['from']);
            } elseif (isset($_SERVER['HTTP_REFERER'])) {
                $flexy->setData('backto', $_SERVER['HTTP_REFERER']);
            } else {
                $flexy->setData('backto', null);
            }
            $flexy->setData('stars', $stars);
            $flexy->setData('sertank', $setrank_url . '&rank=');
            if ($_conf['iphone']) {
                $_conf['extra_headers_ht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}">
EOP;
                $_conf['extra_headers_xht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}" />
EOP;
            }
            $flexy->setData('edit', extension_loaded('gd') && $rank >= 0);
            $flexy->setData('form', $rdr->toObject());
            $flexy->setData('doctype', $_conf['doctype']);
            $flexy->setData('extra_headers', $_conf['extra_headers_ht']);
            $flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
            $flexy->compile('preview.tpl.html');
            P2Util::header_nocache();
            $flexy->output();
    }
    exit;
}
コード例 #24
0
ファイル: Common.php プロジェクト: ballistiq/revive-adserver
 /**
  * A private method to do part of the work of the
  * {@link OA_Admin_Statistics_Common::output()} method.
  *
  * @access private
  * @param array $aElements An optional array of output elements to display.
  */
 function _output($aElements = array())
 {
     global $graphFilter;
     // Prepare the Flexy output object
     $oOutput = new HTML_Template_Flexy(array('templateDir' => $this->templateDir, 'compileDir' => MAX_PATH . '/var/templates_compiled'));
     // Add global variables for backwards compatibility
     if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $GLOBALS['clientid'] = OA_Permission::getEntityId();
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $GLOBALS['affiliateid'] = OA_Permission::getEntityId();
     }
     // Add the current page's entity/breakdown values to the page
     // parameters before generating this page's URI
     $this->aPageParams['entity'] = $this->entity;
     $this->aPageParams['breakdown'] = $this->breakdown;
     // Generate URI used to add other parameters
     $this->_generatePageURI();
     $this->assetPath = OX::assetPath();
     phpAds_PageHeader($this->pageId, $this->getHeaderModel());
     // Welcome text
     if (!empty($this->welcomeText)) {
         echo "<br/>";
         echo $this->welcomeText;
         echo "<br/><br/><br/>";
     }
     // Show the page sections
     phpAds_ShowSections($this->aPageSections, $this->aPageParams, $openNewTable = false);
     $graphVals = $graphFilter;
     // Set columns shown by default
     if (!is_array($graphVals)) {
         if (isset($this->aColumns['sum_views'])) {
             $graphVals[] = 'sum_views';
         }
         if (isset($this->aColumns['sum_clicks'])) {
             $graphVals[] = 'sum_clicks';
         }
     }
     // Prepare the data required for displaying graphs
     $graphFilterArray = $graphVals;
     $imageFormat = null;
     if (!extension_loaded('gd')) {
         $this->aGraphData['noGraph'] = true;
     } else {
         $imgPath = rtrim(MAX::constructURL(MAX_URL_IMAGE), '/');
         if (!function_exists('imagecreate')) {
             $this->aGraphData['noGraph'] = $GLOBALS['strGDnotEnabled'];
         } else {
             $tmpUrl = MAX::constructURL(MAX_URL_ADMIN) . 'stats-showgraph.php?' . $_SERVER['QUERY_STRING'];
             if (is_array($graphFilterArray)) {
                 foreach ($graphFilterArray as $k => $v) {
                     $tmpUrl .= '&graphFields[]=' . $v;
                 }
             }
         }
         $formSubmitLink = explode("/", $_SERVER['REQUEST_URI']);
         $formSubmitLink = $formSubmitLink[count($formSubmitLink) - 1];
         $this->aGraphData['imgPath'] = $imgPath;
         $this->aGraphData['tmpUrl'] = $tmpUrl;
         $this->aGraphData['queryString'] = $_SERVER['QUERY_STRING'];
         $this->aGraphData['formSubmitLink'] = $formSubmitLink;
     }
     // Set the Flexy tags to open/close Javascript
     $this->scriptOpen = "\n<script type=\"text/javascript\"> <!--\n";
     $this->scriptClose = "\n//--> </script>\n";
     // Set whether to automatically display the Graph div, will return true if user has just changed the 'graphFields' value
     $this->autoShowGraph = strpos($_SERVER['QUERY_STRING'], 'graphFields');
     // Set the language vars for statistics display
     $this->strShowGraphOfStatistics = $GLOBALS['strShowGraphOfStatistics'];
     $this->strExportStatisticsToExcel = $GLOBALS['strExportStatisticsToExcel'];
     // Set-up Flexy form for displaying graph
     $aElements['graphFilter[]'] = new HTML_Template_Flexy_Element();
     $aElements['graphFilter[]']->setValue($graphVals);
     if ($this->_isEmptyResultArray()) {
         $this->disableGraph = true;
     }
     // Display page content
     $oOutput->compile($this->template);
     $oOutput->outputObject($this, $aElements);
     $this->_savePrefs();
     phpAds_PageFooter();
 }
コード例 #25
0
 /**
  * output a template (optionally with flexy object & element.)
  *
  * @param   string         name of flexy template.
  * @param   object         object as per HTML_Template_Flexy:outputObject
  * @param   array          elements array as per HTML_Template_Flexy:outputObject    
  * 
  * @return   none
  * @access   public
  */
 function display($templatename, $object = null, $elements = array())
 {
     // some standard stuff available to a smarty template..
     $this->vars['SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME'];
     $o = PEAR::getStaticProperty('HTML_Template_Flexy', 'options');
     require_once 'HTML/Template/Flexy.php';
     $t = new HTML_Template_Flexy();
     $t->compile($templatename);
     $object = $object !== null ? $object : new StdClass();
     foreach ($this->vars as $k => $v) {
         $object->{$k} = $v;
     }
     $t->outputObject($object, $elements);
 }
コード例 #26
0
ファイル: iv2.php プロジェクト: xingskycn/p2-php
 $emj = p2_get_emoji();
 $flexy->setData('e', $emj);
 $flexy->setData('ak', $_conf['k_accesskey_at']);
 $flexy->setData('as', $_conf['k_accesskey_st']);
 // フィルタリング用フォームを表示
 if (!empty($_GET['show_iv2_kfilter'])) {
     !defined('P2_NO_SAVE_PACKET') && define('P2_NO_SAVE_PACKET', true);
     $r = new HTML_QuickForm_Renderer_ObjectFlexy($flexy);
     $qfe['keyword']->removeAttribute('size');
     $qf->updateAttributes(array('method' => 'get'));
     $qf->accept($r);
     $qfObj = $r->toObject();
     $flexy->setData('page', $page);
     $flexy->setData('move', $qfObj);
     P2Util::header_nocache();
     $flexy->compile('iv2if.tpl.html');
     $flexy->output();
     exit;
 } elseif (!empty($_GET['reset_filter'])) {
     unset($_SESSION['iv2i_filter']);
     session_write_close();
 } elseif (!empty($_GET['session_no_close'])) {
     foreach ($overwritable_params as $ow_key) {
         if (isset(${$ow_key})) {
             $_SESSION['iv2i_filter'][$ow_key] = ${$ow_key};
         }
     }
     session_write_close();
 } elseif (!empty($_SESSION['iv2i_filter'])) {
     foreach ($overwritable_params as $ow_key) {
         if (isset($_SESSION['iv2i_filter'][$ow_key])) {
コード例 #27
0
    $curDate .= " 00:00:00";
    $tpl->FECHA = str_replace(' 00:00:00', '', $curDate);
    $cursor = $sql->con->query($q = "SELECT * FROM RESERVA LEFT JOIN CLIENTE ON RUTCLIENRES=RUT_____CLI LEFT JOIN MESA ON MESA____RES=ID______MES LEFT JOIN PEDIDO ON RESERVA_PED=CODIGO__RES LEFT JOIN ESTADO_PEDIDO ON ESTADO__PED=ID______EPE WHERE FECHA___RES BETWEEN '" . $curDate . "' AND DATE_ADD('" . $curDate . "', INTERVAL 1 DAY) {$cond} ORDER BY APELLIDOCLI ASC,FECHA___RES DESC");
    // /*AND NOW() BETWEEN FECHA___RES AND DATE_SUB(FECHA___RES, INTERVAL -DURACIONRES HOUR)*/
    if ($cursor && $cursor->num_rows > 0) {
        while ($row = $cursor->fetch_assoc()) {
            $hora = split(" ", $row['FECHA___RES'])[1];
            $estado = $row['ESTADO__PED'] < 6 ? !empty($row['ESTADO__PED']) ? 'En Curso' : 'Reservada' : 'Finalizada';
            $tpl->RESERVA[$row['CODIGO__RES']] = array("link" => $row['CODIGO__RES'], "mesa" => $row['NUMERO__MES'], "cliente" => $row['RUT_____CLI'] ? $row['APELLIDOCLI'] . ", " . $row['NOMBRE__CLI'] : "Cliente sin Registro", "hora" => $hora, "estado" => $row['DESCRIPCEPE'], "class" => 'reserva-' . $row['ID______EPE']);
        }
    }
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("reservas.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
function codigo()
{
    global $sql;
    $charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $key = '';
    for ($i = 0; $i < 12; $i++) {
        $key .= $charset[mt_rand(0, strlen($charset) - 1)];
    }
    $cursor = $sql->readDB("RESERVA", "CODIGO__RES='" . $key . "'");
    if ($cursor && $cursor->num_rows > 0) {
        return codigo();
    } else {
        return $key;
コード例 #28
0
ファイル: Mailer.php プロジェクト: roojs/Pman.Core
 /**
  * ---------------- Global Tools ---------------   
  */
 function toData()
 {
     $templateFile = $this->template;
     $args = (array) $this->contents;
     $content = clone $this->page;
     foreach ($args as $k => $v) {
         $content->{$k} = $v;
     }
     $content->msgid = empty($content->msgid) ? md5(time() . rand()) : $content->msgid;
     $ff = HTML_FlexyFramework::get();
     $http_host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : 'pman.HTTP_HOST.not.set';
     if (isset($ff->Pman['HTTP_HOST'])) {
         $http_host = $ff->Pman['HTTP_HOST'];
     }
     $content->HTTP_HOST = $http_host;
     // this should be done by having multiple template sources...!!!
     require_once 'HTML/Template/Flexy.php';
     $tmp_opts = array('site_prefix' => false);
     if (!empty($this->templateDir)) {
         $tmp_opts['templateDir'] = $this->templateDir;
     }
     $fopts = HTML_FlexyFramework::get()->HTML_Template_Flexy;
     if (!empty($fopts['DB_DataObject_translator'])) {
         $tmp_opts['DB_DataObject_translator'] = $fopts['DB_DataObject_translator'];
     }
     if (!empty($fopts['locale'])) {
         $tmp_opts['locale'] = $fopts['locale'];
     }
     // local opt's overwrite
     if (!empty($this->locale)) {
         $tmp_opts['locale'] = $this->locale;
     }
     $htmlbody = false;
     $html_tmp_opts = $tmp_opts;
     $htmltemplate = new HTML_Template_Flexy($html_tmp_opts);
     if (is_string($htmltemplate->resolvePath('mail/' . $templateFile . '.body.html'))) {
         // then we have a multi-part email...
         if (!empty($this->html_locale)) {
             $html_tmp_opts['locale'] = $this->html_locale;
         }
         $htmltemplate = new HTML_Template_Flexy($html_tmp_opts);
         $htmltemplate->compile('mail/' . $templateFile . '.body.html');
         $htmlbody = $htmltemplate->bufferedOutputObject($content);
         $this->htmlbody = $htmlbody;
         // for the html body, we may want to convert the attachments to images.
         //            var_dump($htmlbody);exit;
         if ($this->replaceImages) {
             $htmlbody = $this->htmlbodytoCID($htmlbody);
         }
         if ($this->css_embed) {
             $htmlbody = $this->htmlbodyCssEmbed($htmlbody);
         }
     }
     $tmp_opts['nonHTML'] = true;
     //print_R($tmp_opts);
     // $tmp_opts['force'] = true;
     $template = new HTML_Template_Flexy($tmp_opts);
     $template->compile('mail/' . $templateFile . '.txt');
     /* use variables from this object to ouput data. */
     $mailtext = $template->bufferedOutputObject($content);
     //print_r($mailtext);exit;
     //echo "<PRE>";print_R($mailtext);
     /* With the output try and send an email, using a few tricks in Mail_MimeDecode. */
     require_once 'Mail/mimeDecode.php';
     require_once 'Mail.php';
     $decoder = new Mail_mimeDecode($mailtext);
     $parts = $decoder->getSendArray();
     if (PEAR::isError($parts)) {
         return $parts;
         //echo "PROBLEM: {$parts->message}";
         //exit;
     }
     $isMime = false;
     require_once 'Mail/mime.php';
     $mime = new Mail_mime(array('eol' => "\n", 'html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'head_charset' => 'utf-8'));
     // clean up the headers...
     $parts[1]['Message-Id'] = '<' . $content->msgid . '@' . $content->HTTP_HOST . '>';
     if ($htmlbody !== false) {
         // got a html headers...
         if (isset($parts[1]['Content-Type'])) {
             unset($parts[1]['Content-Type']);
         }
         $mime->setTXTBody($parts[2]);
         $mime->setHTMLBody($htmlbody);
         //            var_dump($mime);exit;
         foreach ($this->images as $cid => $cdata) {
             $mime->addHTMLImage($cdata['file'], $cdata['mimetype'], $cid . '.' . $cdata['ext'], true, $cdata['contentid']);
         }
         $isMime = true;
     }
     if (!empty($this->attachments)) {
         //if got a attachments
         $header = $mime->headers($parts[1]);
         if (isset($parts[1]['Content-Type'])) {
             unset($parts[1]['Content-Type']);
         }
         if (!$isMime) {
             if (preg_match('/text\\/html/', $header['Content-Type'])) {
                 $mime->setHTMLBody($parts[2]);
                 $mime->setTXTBody('This message is in HTML only');
             } else {
                 $mime->setTXTBody($parts[2]);
                 $mime->setHTMLBody('<PRE>' . htmlspecialchars($parts[2]) . '</PRE>');
             }
         }
         foreach ($this->attachments as $attch) {
             $mime->addAttachment($attch['file'], $attch['mimetype'], !empty($attch['name']) ? $attch['name'] : '', true);
         }
         $isMime = true;
     }
     if ($isMime) {
         $parts[2] = $mime->get();
         $parts[1] = $mime->headers($parts[1]);
     }
     $ret = array('recipents' => $parts[0], 'headers' => $parts[1], 'body' => $parts[2], 'mailer' => $this);
     if ($this->rcpts !== false) {
         $ret['recipents'] = $this->rcpts;
     }
     // if 'to' is empty, then add the recipents in there... (must be an array?
     if (!empty($ret['recipents']) && is_array($ret['recipents']) && (empty($ret['headers']['To']) || !strlen(trim($ret['headers']['To'])))) {
         $ret['headers']['To'] = implode(',', $ret['recipents']);
     }
     // add bcc if necessary..
     if (!empty($this->bcc)) {
         $ret['bcc'] = $this->bcc;
     }
     return $ret;
 }
コード例 #29
0
            foreach ($options as $k => $v) {
                $ref[$v] = $k;
            }
            $query = "SELECT * FROM " . $ref['TABLE'] . " WHERE " . $ref['INDEX'] . "='" . $value . "';";
            $cursor = $sql->query($query);
            while ($row = $cursor->fetch_assoc()) {
                $retval = $row[$ref['LABEL']];
            }
            break;
        case 'thumb':
            if (empty($value)) {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/100/100/crop/NoDisponible.jpg\" alt=\"Preview\">";
            } else {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/100/100/crop/{$value}\" alt=\"Preview\">";
            }
            break;
        default:
            $retval = $value;
            break;
    }
    //*/
    return $retval;
}
$bread[count($bread) - 1]['active'] = true;
$bread[count($bread) - 1]['link'] = false;
$tpl->BREAD = $bread;
$options = array('templateDir' => 'templates', 'compileDir' => 'tmp');
$output = new HTML_Template_Flexy($options);
$output->compile("platos.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
コード例 #30
0
$urlsPriority = array();
$base = "http://" . $_SERVER['HTTP_HOST'];
$urls = array();
$urlsPriority[] = $base;
$cursor = $sql->readDB("CATEGORIA", "ESTADO__CAT='A'");
while ($row = $cursor->fetch_assoc()) {
    $url = url_slug($row['NOMBRE__CAT']);
    if ($row['PADRE___CAT'] == '-1') {
        $urlsPriority[] = $base . "/" . $url;
    } else {
        $urls[] = $base . "/" . $url;
    }
}
if ($cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'")) {
    while ($row = $cursor->fetch_assoc()) {
        if (!empty($row['TITULO__CON'])) {
            $url = url_slug($row['TITULO__CON']);
        } else {
            $url = "contenido=" . $row["ID______CON"];
        }
        $urls[] = $base . "/" . $url;
    }
}
$tpl->PRIORITY = $urlsPriority;
$tpl->URLS = $urls;
$tpl->DATE = date(DATE_ATOM);
//*
$output = new HTML_Template_Flexy(array('templateDir' => $install . "/template", 'compileDir' => $install . '/tmp'));
$output->compile("sitemap.xml");
$output->outputObject($tpl);
//*/