Пример #1
0
function mainFunction()
{
    global $db;
    $a = file_get_contents('http://www.sberbank-ast.ru/purchaseList.aspx');
    $c = getXMLPart($a);
    $r = preg_split("/purchID>+([0-9]{1,20})+<\\/purchID/", $c, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
    //Получаем массив id аукционов и их кодов
    $auCodes = array();
    $auPages = array();
    for ($i = 0; $i < count($r); $i++) {
        if (preg_match("/^[0-9]{7}/", $r[$i]) == 1) {
            //Если елемент является id
            $idpage = "http://www.sberbank-ast.ru/purchaseview.aspx?id=" . $r[$i];
            array_push($auPages, $idpage);
        } else {
            if (preg_match("/purchCode&gt;.*&lt;\\/purchCode/", $r[$i]) == 1) {
                $code = preg_split("/purchCode&gt;(.*)&lt;\\/purchCode/", $r[$i], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
                array_push($auCodes, $code[1]);
            }
        }
    }
    for ($i = 0; $i < count($auCodes); $i++) {
        //Записываем таблицу аукционов
        $data = array("auction_code" => $auCodes[$i], "auction_page" => $auPages[$i]);
        $db->insert('auction', $data);
    }
    //Получаем и записываем документы для аукционов
    $cols = array("id", "auction_page");
    $results = $db->get("auction", null, $cols);
    if ($db->count > 0) {
        foreach ($results as $result) {
            getDocs($result["auction_page"], $result["id"]);
        }
    }
    //Выводим результаты на страницу
    $toPages = $db->get("auction");
    if ($db->count > 0) {
        foreach ($toPages as $toPage) {
            echo "<tr><td>" . $toPage["auction_code"] . "</td><td>" . $toPage["auction_page"] . "</td>";
            $db->where("auction_id", $toPage["id"]);
            $pageDocs = $db->get("au_doc");
            if ($db->count > 0) {
                echo "<td>";
            }
            foreach ($pageDocs as $pageDoc) {
                echo $pageDoc["au_doc_name"] . " - " . $pageDoc["au_doc_link"] . "<br><br>";
            }
            echo "</td></tr>";
        }
    }
}
Пример #2
0
function getDocs($modx, $startid, $priority, $changefreq, $excludeTV, $seeThruUnpub)
{
    //If need to see through unpublished
    if ($seeThruUnpub) {
        //Get all children documents, filter later
        $docs = $modx->getAllChildren($startid, 'menuindex', 'asc', 'id,editedon,template,published,searchable,pagetitle,type');
    } else {
        //Get only published children documents
        $docs = $modx->getActiveChildren($startid, 'menuindex', 'asc', 'id,editedon,template,published,searchable,pagetitle,type');
    }
    // add sub-children to the list
    foreach ($docs as $key => $doc) {
        $id = $doc['id'];
        $docs[$key][$priority] = getTV($modx, $id, $priority);
        // add priority property
        $docs[$key][$changefreq] = getTV($modx, $id, $changefreq);
        // add changefreq property
        $docs[$key][$excludeTV] = getTV($modx, $id, $excludeTV);
        // add excludeTV property
        //TODO: $modx->getAllChildren & $modx->getActiveChildren always return the array
        // 		if ($modx->getAllChildren($id)){
        $docs = array_merge($docs, getDocs($modx, $id, $priority, $changefreq, $excludeTV, $seeThruUnpub));
        // 		}
    }
    return $docs;
}
Пример #3
0
function getDocs($fnName)
{
    $o = '';
    // support recursive lookup for arrays:
    if (is_array($fnName)) {
        foreach ($fnName as $name) {
            $o .= getDocs($name);
        }
        return $o;
    }
    global $methodDocs;
    $paramStr = '';
    $paramBlock = '';
    if (isset($methodDocs[$fnName]['params'])) {
        $paramBlock .= '<h5 class="linkable" id="' . $fnName . '-parameters">PARAMETERS:</h5>' . '<ul>';
        $coma = '';
        foreach ($methodDocs[$fnName]['params'] as $paramName => $param) {
            if (isset($param['optional']) && $param['optional'] == true) {
                $paramStr .= $coma . ' [' . $paramName . ']';
            } else {
                $paramStr .= $coma . $paramName;
            }
            $paramBlock .= '<li><b>' . $paramName . '</b> ' . getDocTypeStr($param) . $param['desc'] . "</li>";
            $coma = ', ';
        }
        $paramBlock .= '</ul>';
    }
    $o = '<hr></hr>' . '<h4 class="linkable" id="' . $fnName . '">' . $fnName . ' (' . $paramStr . ')</h4>' . '<span class="description">' . $methodDocs[$fnName]['desc'] . '</span>' . '<div class="docblock">';
    // output parameters if set:
    $o .= $paramBlock;
    // output returns if set:
    if (isset($methodDocs[$fnName]['returns'])) {
        $o .= '<h5 id="' . $fnName . '-returns">RETURNS:</h5>';
        $o .= '<ul><li>' . getDocTypeStr($methodDocs[$fnName]['returns']) . ' ' . $methodDocs[$fnName]['returns']['desc'] . '</li></ul>';
    }
    // output examples if set:
    if (isset($methodDocs[$fnName]['examples'])) {
        $o .= '<h5 class="linkable" id="' . $fnName . '-examples">EXAMPLES:</h5><ul>';
        foreach ($methodDocs[$fnName]['examples'] as $example) {
            $text = '';
            if (!isset($example['type'])) {
                $example['type'] = 'link';
            }
            switch ($example['type']) {
                case 'link':
                    $link = isset($example['docPath']) ? 'index.php?path=' . $example['docPath'] : '';
                    if ($link == '' && isset($example['docFullPath'])) {
                        $link = '../' . $example['docFullPath'];
                    }
                    $text = '<a href="' . $link . '">' . $example['name'] . '</a>';
                    break;
                case 'code':
                    $text = $example['name'] . '<br><pre class="prettyprint linenums">' . htmlspecialchars($example['code']) . '</pre>';
                    break;
            }
            $o .= '<li>' . $text . '</li>';
        }
        $o .= '</ul>';
    }
    // close <div class="docblock">
    $o .= '</div>';
    return $o;
}
Пример #4
0
    $post = $_POST;
} else {
    $post = $_SESSION['post'];
    if (isset($post)) {
        //$_SESSION['post'] = '';
        //unset($_SESSION['post']);
    }
}
include $_SERVER['DOCUMENT_ROOT'] . '/reportes/includes/conectadb.inc.php';
$ot = $post['ot'];
$numedicion = $post['numedicion'];
$id = $post['id'];
$observaciones = getObs($post['id']);
$nombreot = getOT();
$documentos = datostabla();
$docs = getDocs();
include 'formacroquis.html.php';
exit;
/**************************************************************************************************/
/* Obtener el nombre de la orden */
/**************************************************************************************************/
function getOT()
{
    global $pdo, $ot;
    try {
        $sql = 'SELECT ot
		FROM ordenestbl
		WHERE id = :id';
        $s = $pdo->prepare($sql);
        $s->bindValue(':id', $ot);
        $s->execute();