<?php

require_once "coreg2.php";
debug("Import elements from CSV", "white");
foreach ($SYS["APPS"] as $app) {
    set_include_dir($SYS["BASE"] . "/Apps/" . $app . "/.");
}
$data = file($_FILES["fichero_csv"]["tmp_name"]);
$FIELDS = explode(";", current($data));
foreach ($FIELDS as $a => $b) {
    $FIELDS[$a] = strtolower(trim(strtr($b, "\"'", "  ")));
}
dataDump($FIELDS);
foreach ($data as $k => $v) {
    if ($k != 0) {
        $DATAFIELDS = explode(";", $v);
        foreach ($DATAFIELDS as $a => $b) {
            $DATAFIELDS[$a] = strtr($b, "\"'", "");
        }
        $q = "INSERT INTO {$prefix}_{$table} (`" . implode("`,`", $FIELDS) . "`) VALUES (" . implode(",", $DATAFIELDS) . ")";
        _query($q);
    }
}
 function block()
 {
     /*global $auth;
     
     		$elements=$this->get();
     		
     		if (empty($elements)) {
     			echo "Carrito vacio";
     			$elements=array();
     		}
     
     		require_once("Lib/lib_planty.php");
     		$pr=new plantilla("block_carrito");
     		echo $pr->plParseTemplateHeader();
     
     		ksort($elements,SORT_NUMERIC);
     
     		foreach ($elements as $ID=>$cantidad) {
     
     			$entry=newObject("Artepyme::psDetalle_pr",1);
     			$item=newObject("Artepyme::psProductos",$ID);
     		
     			$entry->id_articulo=$ID;
     			$entry->precio_venta=(float)current($item->getPrecio());			
     			$entry->precio_oferta=(float)$item->pop;			
     			$entry->cantidad=$cantidad;
     			$entry->precio_venta_total=(float)$entry->precio_venta*$cantidad;
     			$entry->iva=(float)next($item->getPrecio());
     			$entry->iva2=(float)($entry->iva/100)*$entry->precio_venta_total;
     			$entry->total=(float)$entry->iva2+$entry->precio_venta_total;
     			$total+=(float)$entry->total;
     			$total_iva+=(float)$entry->iva2;
     
     
     			//dataDump($entry);
     			$entry->nombre=$item->nombre;
     			if (end($item->getPrecio())=="oferta")
     				$entry->oferta="*";
     			echo $pr->plParseTemplate($entry);
     
     		}
     		$totales=array(total=>$total,total_iva=>$total_iva);
        		echo $pr->plParseTemplateFooter($totales);
     		*/
     dataDump($this);
 }
<?php

@define('MEMO_BASE', dirname(__FILE__));
require_once MEMO_BASE . '/lib/base.php';
$horde_module = MEMO_BASE;
error_reporting(E_ALL ^ E_NOTICE);
require_once "../framework/coreg2.php";
dataDump($_POST);
dataDump($_FILES);
Beispiel #4
0
 function showProperties()
 {
     global $prefix;
     reset($this->properties);
     reset($this->properties_type);
     reset($this->properties_desc);
     echo "<table border=\"1\" cellpadding=\"1\">";
     echo "<th>Propiedad</th><th>Valor actual</th><th>Tipo</th><th>Descripcion</th>";
     for ($i = 0, $loop_c = sizeof($this->properties); $i < $loop_c; $i++) {
         echo "<tr>";
         echo "<td>" . key($this->properties) . "</td>";
         echo "<td>" . current($this->properties) . "</td>";
         echo "<td>" . current($this->properties_type) . "</td>";
         echo "<td>" . current($this->properties_desc) . "</td>";
         echo "</tr>";
         $q .= key($this->properties) . "\t" . current($this->properties) . "\t" . current($this->properties_type) . "\t" . current($this->properties_desc) . "\n";
         next($this->properties_desc);
         next($this->properties_type);
         next($this->properties);
     }
     echo "<tr><td>DataBase Instance</td><td colspan=\"3\">";
     $res = _query("SHOW TABLE STATUS LIKE '{$prefix}_{$this->name}'");
     dataDump(_fetch_array($res));
     echo "</td></tr></table>";
 }
Beispiel #5
0
function plantView($object, $campos, $template, $debug = false)
{
    $users = new plantilla($template);
    //dataDump($object);
    foreach ($campos as $fld => $type) {
        $multitype = explode("#", $type);
        switch ($multitype[0]) {
            case "texto":
                $object->{$fld} = substr(strip_tags($object->f($fld)), 0, 68) . " ....";
                break;
            case "parrafo":
                $object->{$fld} = nl2br(strip_tags($object->f($fld), "<br />"));
                break;
            case "fecha":
                $object->{$fld} = strftime("%d/%m/%Y", (int) $object->f($fld));
                break;
            case "ref":
                $obj = explode("|", $multitype[1]);
                $class = $obj[0];
                $field = $obj[1];
                $nfield = $obj[2];
                $void = newObject($class, $object->f($fld));
                if (empty($nfield)) {
                    $object->{$fld} = $void->f($field);
                } else {
                    $object->{$nfield} = $void->f($field);
                }
                break;
            case "xref":
                $obj = explode("|", $multitype[1]);
                $class = $obj[0];
                $field = $obj[2];
                $xid = $obj[1];
                $void = newObject($class, $object->f($xid));
                $object->{$fld} = $void->f($field);
                break;
            case "fref":
                $obj = explode("|", $multitype[1]);
                $class = $obj[0];
                $field = $obj[2];
                $xid = $obj[1];
                $void = newObject($class, $object->f($xid));
                $object->{$fld} = $void->{$field}();
                break;
            case "hora":
                $object->{$fld} = strftime("%H:%M", (int) $object->f($fld));
                break;
            case "var":
                $object->{$fld} = 0;
                break;
            case "code":
                //dataDump(get_class_methods($object));
                $object->{$fld} = eval($multitype[1]);
                //echo '$object->$fld='.$object->$fld;
                break;
        }
    }
    if (is_object($object)) {
        echo $users->plParseTemplateHeader(get_object_vars($object));
        echo $users->plParseTemplate(get_object_vars($object));
        echo $users->plParseTemplateFooter(get_object_vars($object));
    } else {
        echo $users->plParseTemplateHeader($object);
        echo $users->plParseTemplate($object);
        echo $users->plParseTemplateFooter($object);
    }
    if ($debug) {
        dataDump($object);
    }
    return True;
}
<?php

$core = new core();
echo "<hr><div style=\"font-size:12pt;font-weight:bold;\" align=\"center\">Core G2. version " . $core->VERSION . "</div><br><hr>";
if (empty($class)) {
    $class = "example";
}
$tmp = new Ente($class);
$module = $SYS["PROJECT"];
$column = "ID";
echo "<pre>Nombre de Clase: " . $class . "\n";
echo "Nombre de Modulo: " . $SYS["PROJECT"] . "\n";
echo "Nombre de Tabla. {$prefix}_{$class}\n";
echo "Clave primaria. ID" . "\n</pre>";
echo "<pre>Generando Tabla</pre>";
if (_query("ALTER TABLE `{$prefix}_{$class}` TYPE = innodb")) {
    echo "<!--STATUS:OK-->";
    echo "STATUS:OK";
}
$res = _query("SHOW TABLE STATUS LIKE '{$prefix}_{$class}'");
dataDump(_fetch_array($res));
?>

Beispiel #7
0
<?php

$cClass = ucfirst($class);
$cClass = "ps" . $cClass;
echo ":: <b>Test CoreG2</b><br>";
$test = new Ente($class);
if (isset($test)) {
    $status = True;
}
$test->showProperties();
dataDump($test);
if ($status) {
    echo "\n<!--STATUS:OK-->\nSTATUS:OK";
} else {
    echo "\n<!--STATUS:KO-->\nSTATUS:KO";
}