Esempio n. 1
0
 public function ouvrir($nom)
 {
     $xml_doc = new xml_struct();
     $ret = $xml_doc->ouvrir($nom);
     if ($ret) {
         // Traitement des documents
         $nb_docs = $xml_doc->compter_elements(_DOCUMENT_DOC);
         $xml_doc->pointer_sur_balise(_DOCUMENT_DOC);
         for ($cpt = 0; $cpt < $nb_docs; $cpt++) {
             $nom = $xml_doc->lire_n_attribut(_XML_NOM, $cpt);
             if (strlen($nom) > 0) {
                 $fichier = $xml_doc->lire_n_valeur(_DOCUMENT_DOC_FICHIER, $cpt);
                 $info = $xml_doc->lire_n_valeur(_DOCUMENT_DOC_INFO, $cpt);
                 $legende = $xml_doc->lire_n_valeur(_DOCUMENT_DOC_LEGENDE, $cpt);
                 // Création de l'objet document si le nom de fichier n'est pas vide
                 if (strlen($fichier) > 0) {
                     $doc = new document();
                     $doc->set_fichier(_XML_PATH_FICHIERS . $fichier);
                     $doc->ins_info($info);
                     $doc->ins_legende($legende);
                     $this->docs[$nom] = $doc;
                 }
             }
         }
     }
     return $ret;
 }
 function showDocItem($output_type, $item_num, $row_num, $documents_id = null)
 {
     $doc = new document();
     if ($doc->getFromDB($documents_id)) {
         return Search::showItem($output_type, $doc->getDownloadLink(), $item_num, $row_num);
     }
     return Search::showItem($output_type, "", $item_num, $row_num);
 }
Esempio n. 3
0
 /**
  * Add the attached description files.
  *
  * @param document $document The current document
  * @return null
  */
 public function attach_files($document)
 {
     $fs = get_file_storage();
     $cm = $this->get_cm($this->get_module_name(), $document->get('itemid'), $document->get('courseid'));
     $context = \context_module::instance($cm->id);
     $files = $fs->get_area_files($context->id, 'mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA, 0, 'sortorder DESC, id ASC', false);
     foreach ($files as $file) {
         $document->add_stored_file($file);
     }
 }
Esempio n. 4
0
 /**
  * Add the main file to the index.
  *
  * @param document $document The current document
  * @return null
  */
 public function attach_files($document)
 {
     $fs = get_file_storage();
     $cm = $this->get_cm($this->get_module_name(), $document->get('itemid'), $document->get('courseid'));
     $context = \context_module::instance($cm->id);
     // Order by sortorder desc, the first is consided the main file.
     $files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder DESC, id ASC', false);
     $mainfile = $files ? reset($files) : null;
     if ($mainfile && $mainfile->get_sortorder() > 0) {
         $document->add_stored_file($mainfile);
     }
 }
 /**
  * Delete document action
  *
  * @param void
  * @return void
  */
 function delete()
 {
     if ($this->active_document->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_document->canDelete($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $delete = $this->active_document->delete();
         if ($delete && !is_error($delete)) {
             db_commit();
             flash_success('Document ":document_name" has been deleted', array('document_name' => $this->active_document->getName()));
         } else {
             db_rollback();
             flash_error('Failed to delete ":document_name"', array('document_name' => $this->active_document->getName()));
         }
         // if
         $this->redirectTo('documents');
     } else {
         $this->httpError(HTTP_BAD_REQUEST);
     }
     // if
 }
Esempio n. 6
0
function findDocuments()
{
    //Find documents and metadata from various sources
    //for loop through each source
    // for each document found in the source:
    $doc = new document();
    //How to save document found in the current source
    $doc->add_url("http://eventful.com/event/1");
    $doc->name = "dancefestival";
    $doc->add_artist("who");
    $doc->description = "This is a test, for the decompose-test. Decomposition available availability. It didn't work filing";
    $doc = decomposeDocument($doc);
    $doc = multiLabelClassification($doc);
    foreach ($doc->tags as $tag) {
        echo "{$tag} <br>";
    }
    $doc = clusterDocument($doc);
    $doc = findDuplicate($doc);
    saveToIndex($doc);
}
Esempio n. 7
0
/*********************************************************************************************************************************
||																																||
||										AIMSys - Aircraft Inventory & Maintenance System										||
||										Jeremy Bloomstrom																		||
||										Ingenious Design																		||
||										jeremy@in.genio.us																		||
||										March 27, 2013																			||
||																																||
|________________________________________________________________________________________________________________________________|
||																																||
||																																||
||										popup.php																				||
||										VIEW																					||
||																																||
*********************************************************************************************************************************/
// Do Some Logic stuff
$table = req::_('table');
$rowid = req::_('rowid', 'new');
$editing = true;
// Initialize table by getting params and populating with data.
$oEditor = new editor($table, $rowid);
$oEditor->_getData();
$editor_html = $oEditor->_html();
// Get View
$oView = new view($view);
// Display View Script and View HTML
echo document::_addScript($oView->_script());
echo document::_addScript("ready.js");
include_once $oView->_html();
echo '<div class="clear"></div>';
//pre($data);
Esempio n. 8
0
require 'path.php';
init_cobalt('Delete document');
if (isset($_GET['document_id'])) {
    $document_id = urldecode($_GET['document_id']);
    require_once 'form_data_document.php';
}
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_delete']);
    require 'components/query_string_standard.php';
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_document.php?{$query_string}");
    } elseif ($_POST['btn_delete']) {
        log_action('Pressed delete button');
        require_once 'subclasses/document.php';
        $dbh_document = new document();
        $object_name = 'dbh_document';
        require 'components/create_form_data.php';
        $dbh_document->delete($arr_form_data);
        redirect("listview_document.php?{$query_string}");
    }
}
require 'subclasses/document_html.php';
$html = new document_html();
$html->draw_header('Delete Document', $message, $message_type);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->draw_hidden('document_id');
$html->detail_view = TRUE;
$html->draw_controls('delete');
$html->draw_footer();
Esempio n. 9
0
    case 'ADD':
        $objComm->checkReadWriteAccess($type);
        if (isset($_REQUEST['btn_submit']) && $_REQUEST['btn_submit'] == 'save') {
            $objDoc = new document();
            $objDoc->setDocument();
            $objComm->redirect1('index.php?model=' . $model . '&type=' . $type);
        }
        break;
    case 'EDIT':
        $objComm->checkReadWriteAccess($type);
        $objDoc = new document();
        if (isset($_REQUEST['btn_submit']) && $_REQUEST['btn_submit'] == 'update') {
            $objDoc->setDocument($_REQUEST);
            $objComm->redirect1('index.php?model=' . $model . '&action=edit&type=' . $type . '&id=' . $_REQUEST['pk_id'] . '&parent_id=' . $_REQUEST['parent_id']);
        } else {
            $row = $objDoc->getDocument($_REQUEST['id']);
            $objComm->checkReadWriteAccess($row->CreatedBy);
        }
        break;
    case 'DELETE':
        $objComm->checkReadWriteAccess($type);
        $objDoc = new document();
        $objDoc->delDocument($_REQUEST['id']);
        $objComm->redirect1('index.php?model=' . $model . '&type=' . $type);
        break;
    default:
        $objDoc = new document();
        $Records = $objDoc->getAllDocument($WorkGroupID);
        $strTree = $objDoc->makeHierarchy($type);
        break;
}
Esempio n. 10
0
     foreach ($docdata["felder"] as $zeile) {
         $value = $zeile["platzhalter"];
         $name = strtoupper($value);
         if (ini_get("default_charset") == 'utf-8') {
             $vars[$name] = utf8_decode($_POST[$value]);
         } else {
             $vars[$name] = $_POST[$value];
         }
     }
 }
 $doc->parse($vars);
 $name = date("YmdHi") . $fname;
 $doc->prepsave("{$name}");
 $pfad = $_POST['pfad'];
 copy('tmp/' . $name, "dokumente/" . $_SESSION["dbname"] . "{$pfad}/{$name}");
 $dbfile = new document();
 $dbfile->setDocData("descript", "Dokumentvorlage: " . $docdata["document"]["vorlage"] . "\n" . $docdata["document"]["beschreibung"]);
 $dbfile->setDocData("name", $name);
 $dbfile->setDocData("pfad", $pfad);
 $rc = $dbfile->saveDocument();
 //$doc->clean();
 $cdata["id"] = mknewTelCall();
 $cdata["Datum"] = date("d.m.Y");
 $cdata["Date"] = date("d.m.Y");
 $cdata["Zeit"] = date("H:i");
 $cdata["Time"] = date("H:i");
 $cdata["datei"] = 1;
 $cdata["cause"] = $docdata["document"]["vorlage"];
 $cdata["c_cause"] = $docdata["document"]["beschreibung"];
 $cdata["CID"] = $pid ? $pid : $fid;
 $cdata["Kontakt"] = "D";
Esempio n. 11
0
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('View document');
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_document.php");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        require 'subclasses/document.php';
        $dbh_document = new document();
        if ($message == "") {
            log_action('Exported table data to CSV');
            $timestamp = date('Y-m-d');
            $token = generate_token(0, 'fs');
            $csv_name = $token . $_SESSION['user'] . '_document_' . $timestamp . '.csv';
            $filename = TMP_DIRECTORY . '/' . $csv_name;
            $csv_contents = $dbh_document->export_to_csv();
            $csv_file = fopen($filename, "wb");
            fwrite($csv_file, $csv_contents);
            fclose($csv_file);
            chmod($filename, 0755);
            $csv_name = urlencode($csv_name);
            $message = 'CSV file successfully generated: <a href="/' . BASE_DIRECTORY . '/download_generic.php?filename=' . $csv_name . '">Download the CSV file.</a>';
            $message_type = 'system';
        }
Esempio n. 12
0
function _saveWvl($data)
{
    if ($data['WVLID'] < 1) {
        $data = array_merge($data, mknewWVL(false));
        if ($data['WVLID'] < 1) {
            echo "-3";
            return;
        }
    }
    if (!$data["DCaption"]) {
        $data["DCaption"] = $data["cause"];
    }
    if ($data['newfile'] == 1 and $data['filename'] != '') {
        $src = $_SESSION['crmpath'] . '/dokumente/' . $_SESSION["dbname"] . '/' . $_SESSION['login'] . '/tmp/';
        $rc = file_exists($src . $data['filename']);
        if ($rc) {
            if ($data["DateiID"]) {
                delDokument($data["DateiID"]);
            }
            // ein altes löschen
            require_once "documents.php";
            $dest = $_SESSION['crmpath'] . '/dokumente/' . $_SESSION["dbname"] . '/' . $_SESSION["login"] . '/';
            copy($src . $data['filename'], $dest . $data['filename']);
            unlink($src . $data['filename']);
            //Dokument in db speichern
            $dbfile = new document();
            $dbfile->setDocData("descript", $data["subject"]);
            $dbfile->setDocData("pfad", $_SESSION["login"]);
            $dbfile->setDocData("name", $data['filename']);
            $dbfile->setDocData("descript", $data["DCaption"]);
            $rc = $dbfile->newDocument();
            $dbfile->saveDocument();
            if (!$dbfile->id > 0) {
                echo "-4";
                return;
            }
            $data["DateiID"] = $dbfile->id;
        } else {
            echo "-5";
            return;
        }
    }
    $rc = updWvl($data);
    echo $rc;
}
Esempio n. 13
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     document::create($request->all());
     return redirect('admin/documents')->with('success', Lang::get('message.success.create'));
 }
Esempio n. 14
0
             $okA = false;
             $msg .= " Abs:" . $rc;
         }
     } else {
         $okA = false;
         $msg .= " Kein Absender";
     }
 }
 if ($okC && $okA) {
     $dateiname = "";
     if ($_FILES["Datei"]["name"] != "") {
         $dat["Datei"]["name"] = $_FILES["Datei"]["name"];
         $dat["Datei"]["tmp_name"] = $_FILES["Datei"]["tmp_name"];
         $dat["Datei"]["type"] = $_FILES["Datei"]["type"];
         $dat["Datei"]["size"] = $_FILES["Datei"]["size"];
         $dbfile = new document();
         $dbfile->setDocData("descript", $Subject);
         $ok = chkdir($_SESSION["login"] . '/SerMail');
         $pfad = $_SESSION["login"] . '/SerMail';
         $rc = $dbfile->uploadDocument($_FILES, $pfad);
         $dateiID = $dbfile->id;
         $dateiname = $_FILES["Datei"]["name"];
     }
     $limit = 50;
     $SubjectMail = mb_encode_mimeheader($Subject, $_SESSION["charset"], 'Q', '');
     $headers = array("Return-Path" => $user["email"], "Reply-To" => $abs, "From" => $abs, "X-Mailer" => "PHP/" . phpversion(), "Subject" => $SubjectMail);
     if ($dateiname == "") {
         $headers["Content-Type"] = "text/plain; charset=" . $_SESSION["charset"];
     }
     $_SESSION["headers"] = $headers;
     $_SESSION["Subject"] = $Subject;
Esempio n. 15
0
<?php

include_once dirname(__FILE__) . '/bootstrap.php';
$DocID = $_REQUEST['id'];
$UserID = $_SESSION['site']['pm_row']->UserID;
$WorkGroupID = $_SESSION['site']['pm_row']->WorkgroupID;
$objDoc = new document();
$DocRow = $objDoc->getDocument($DocID);
if ($_SESSION['admin']['pm_user_row']->IsAdmin == 1) {
    $objComm->downloadFile($DocRow->DocumentName, $DocRow->DocumentPath);
}
if ($DocRow->WorkgroupID == 0) {
    $objComm->downloadFile($DocRow->DocumentName, $DocRow->DocumentPath);
} else {
    if ($DocRow->WorkgroupID == $WorkGroupID) {
        $objComm->downloadFile($DocRow->DocumentName, $DocRow->DocumentPath);
    }
}
Esempio n. 16
0
 public static function OutputMockagendaUpdate($updateCurrentEvents = FALSE, $updateFutureEvents = FALSE, $showOnlyAgendaOptions = FALSE)
 {
     $stdout = "";
     $options = $headers = $allConfids = $allConfidsUpdated = array();
     $eventTitle = $updatedRecords = array();
     $numberOfUpdatedRecords = 0;
     // ----------------------------------------------
     // -- GPC and initiations
     // ----------------------------------------------
     // UPDATE manually kept fields from legacy file - ALL events:
     functions::gpc_declare_input("uf", false, true);
     // UPDATE VM fields [disabled]:
     functions::gpc_declare_input("uv", false, true);
     // UPDATE Agenda fields - ALL events:
     functions::gpc_declare_input("ua", false, true);
     // UPDATE Agenda fields - CURRENT events:
     functions::gpc_declare_input("uc", $updateCurrentEvents && !$updateFutureEvents, true);
     // UPDATE Agenda fields - CURRENT and FUTURE events:
     functions::gpc_declare_input("un", $updateCurrentEvents && $updateFutureEvents, true);
     // Recreate 'menulookup' cache:
     functions::gpc_declare_input("um", false, true);
     if (!class_exists("fromdb_nwevents", FALSE)) {
         require_once PATH_CLASSES . "/fromdb/nwevents.php";
     }
     if (!isset($dbEv) || !is_object($dbEv)) {
         $dbEv = new fromdb_nwevents();
     }
     $allConfids = $dbEv->getAgendaConferenceIdsForNorditaEvents();
     $noRecordsInDB = (bool) (!is_array($allConfids) || empty($allConfids));
     if ($noRecordsInDB) {
         $GLOBALS["uv"] = $GLOBALS["ua"] = $GLOBALS["un"] = false;
     }
     // ----------------------------------------------
     // -- Act on selected option
     // ----------------------------------------------
     // UPDATE manually kept fields from legacy file - ALL events
     if ($GLOBALS["uf"]) {
         $numberOfUpdatedRecords = $dbEv->updateEventsFromLocalFile();
         if ($numberOfUpdatedRecords) {
             $noRecordsInDB = false;
         }
     } elseif ($GLOBALS["uv"]) {
         //if (!class_exists("fromdb_vm",FALSE)) require_once PATH_CLASSES . "/fromdb/vm.php";
         //$dbEv = new fromdb_vm();
         //$numberOfUpdatedRecords = ...();
     } elseif ($GLOBALS["ua"]) {
         $updatedRecords = $dbEv->updateEventsFromAgenda("");
         $numberOfUpdatedRecords = is_array($updatedRecords) ? count($updatedRecords) : $updatedRecords;
     } elseif ($GLOBALS["uc"]) {
         $updatedRecords = $dbEv->updateCurrentEventsFromAgenda();
         $numberOfUpdatedRecords = is_array($updatedRecords) ? count($updatedRecords) : $updatedRecords;
         document::recreateMenulookupCache();
         // also recreate menu cache, to make sure
     } elseif ($GLOBALS["un"]) {
         $updatedRecords = $dbEv->updateEventsFromAgenda(date("Y-m-d", strtotime("-50 days")));
         $numberOfUpdatedRecords = is_array($updatedRecords) ? count($updatedRecords) : $updatedRecords;
         document::recreateMenulookupCache();
         // also recreate menu cache, to make sure
     } elseif ($GLOBALS["um"]) {
         if (document::recreateMenulookupCache()) {
             $stdout .= "\r\n" . functions::boxMessage("confirm", "<strong>Cache 'menulookup'</strong> was successfully recreated.") . "\r\n";
         } else {
             $stdout .= "\r\n" . functions::boxMessage("error", "<strong>Cache 'menulookup'</strong> could not be recreated") . "\r\n";
         }
     }
     // -----------------------
     $allConfidsUpdated = $numberOfUpdatedRecords ? $dbEv->getAgendaConferenceIdsForNorditaEvents() : $allConfids;
     // ----------------------------------------------
     // -- Output
     // ----------------------------------------------
     $stdout .= "  <p class='largefont'>There are currently <strong>" . count($allConfidsUpdated) . " events</strong> in the local 'nw_events' database.</p>\r\n";
     // -----------------------
     $stdout .= "<div class='col c1of2'>\r\n";
     $stdout .= "  <p><strong>The local database 'nw_events'</strong> collects information of Nordita events (programs, workshops, conferences, meetings, schools) from several sources: most data comes from the <strong>AlbaNova Agenda database</strong>; some fields are fetched from the <strong>VM database</strong>; and some metadata fields are <strong>manually kept only in the 'nw_events' database</strong>.</p>\r\n";
     if (!$showOnlyAgendaOptions) {
         $headers["manual"] = "Manually Kept Files";
         $options["manual"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?uf=1'>UPDATE manually kept fields from legacy file - ALL events</a>";
         if (!$noRecordsInDB) {
             $options["manual"][] = "<a href='" . str_replace("nw_events_update", "nw_events_edit", $_SERVER["PHP_SELF"]) . "'>" . "EDIT manually kept fields - SINGLE event</a> " . "<span style='padding-left:1em;font-weight:normal;white-space:nowrap'>(use [Edit] links)</span>";
         }
     }
     $headers["agenda"] = "Agenda Fields";
     if (!$showOnlyAgendaOptions) {
         $options["agenda"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?ua=1'>UPDATE Agenda fields - ALL events</a> " . "<span style='padding-left:1em;font-weight:normal;white-space:nowrap'>(going back to 2007)</span>";
     }
     if (!$noRecordsInDB) {
         $options["agenda"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?uc=1'>UPDATE Agenda fields - CURRENT events</a>";
     }
     if (!$noRecordsInDB) {
         $options["agenda"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?un=1'>UPDATE Agenda fields - CURRENT and FUTURE events</a>";
     }
     if (!$showOnlyAgendaOptions) {
         if (!$noRecordsInDB) {
             $options["agenda"][] = "<a href='" . str_replace("nw_events_update", "nw_events_edit", $_SERVER["PHP_SELF"]) . "'>UPDATE Agenda fields - SINGLE event</a> <span style='padding-left:1em;font-weight:normal;white-space:nowrap'>(use [Update] links)</span>";
         }
         $options["agenda"][] = "<a href='" . AGENDA_URI . "/'>EDIT Agenda events</a> " . EXTERNAL_LINK;
     }
     if (!$showOnlyAgendaOptions) {
         $headers["vm"] = "VM Fields";
         $options["vm"][] = "[UPDATE VM fields - disabled]";
         //$options["vm"][] = "<a href='".$_SERVER["PHP_SELF"]."?uv=1'>UPDATE VM fields</a>";
     }
     if (!$showOnlyAgendaOptions) {
         $headers["varia"] = "Varia";
         $options["varia"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?um=1'>Recreate 'menulookup' cache</a>";
     }
     //$stdout .= "<p><strong>&#187; Update event records in database 'nw_events'...</strong></p>\r\n";
     foreach (array("manual", "agenda", "vm", "varia") as $db) {
         if (!empty($options[$db])) {
             $stdout .= (!empty($headers[$db]) ? "<h4>" . $headers[$db] . "</h4>\r\n" : "") . "<ul class='bold tightlist'>\r\n" . "  <li>" . implode($options[$db], "</li>\r\n  <li>") . "</li>\r\n" . "</ul>\r\n";
         }
     }
     // -----------------------
     $stdout .= "</div> <div class='col c2of2'>\r\n";
     if (!empty($_REQUEST) && !$GLOBALS["um"] && !$noRecordsInDB && isset($numberOfUpdatedRecords)) {
         $stdout .= $numberOfUpdatedRecords > 0 ? "  <p class='box padding confirm background'>Successfully updated " . "<strong>" . $numberOfUpdatedRecords . "</strong> records in the database 'nw_events'.</p>\r\n" : "  <p class='box padding error background'><strong>Could not update any records</strong> " . "in the database 'nw_events'." . (!$noRecordsInDB && $numberOfUpdatedRecords == ERROR_NO_EVENTS_REQUESTED ? " [No events requested]" : "") . (!$noRecordsInDB && $numberOfUpdatedRecords == 0 ? " [No events updated]" : "") . "</p>\r\n";
         if (count($updatedRecords)) {
             $stdout .= "  <ul>\r\n";
             foreach ($updatedRecords as $confId) {
                 $stdout .= "    <li><a href='http://agenda.albanova.se/conferenceDisplay.py?confId=" . $confId . "'>" . $dbEv->getEventTitle($confId) . "</a></li>\r\n";
             }
             $stdout .= "  </ul>\r\n";
         }
     }
     // -----------------------
     $stdout .= "</div><div style='clear:both'><br></div>\r\n";
     // -----------------------
     return $stdout;
 }
Esempio n. 17
0
<?php

//****************************************************************************************
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('Add document');
require 'components/get_listview_referrer.php';
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/document.php';
    $dbh_document = new document();
    $object_name = 'dbh_document';
    require 'components/create_form_data.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_document.php?{$query_string}");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        $message .= $dbh_document->sanitize($arr_form_data)->lst_error;
        extract($arr_form_data);
        if ($dbh_document->check_uniqueness($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
        }
Esempio n. 18
0
<?php

document::begin('html/4.01');
?>
<html lang="en-us">
    <head>
        <title><?php 
echo LEPTON_PLATFORM_ID;
?>
</title>
    </head>
    <body>
    	<h1>Test results</h1>
    	<?	using('lepton.utils.tests'); ?>
    	<?	using('tests.*'); ?>
    	<?	using('app.tests.*'); ?>
    	<?	
    		class HtmlReporter extends TestReporter {
    			function beginGroup($title) {
    				printf('<h2>%s</h2>',$title);
    				printf('<table><tr>');
    				foreach(array(
    					'Test' => 50,
    					'Text' => 300,
    					'Status' => 90
    				) as $title=>$width) printf('<th width="%d">%s</th>', $width, $title);
    				printf('</tr>');
    			}
    			function addItem($index,$text,$status) {
    				printf('<tr><td>%s</td><td>%s</td><td>%s</td></tr>', $index, $text, $status);
    			}
Esempio n. 19
0
<?php

// ===========================================================================
// INDEX.PHP
// ===========================================================================
// ----------------------------------------
// Change for each file:
define("RELPATHTOROOT", "../");
// ----------------------------------------
// Do not touch:
define("INCLEVEL", realpath(RELPATHTOROOT) . "/");
require_once INCLEVEL . "classes/headerNordita_HVZM.php";
$page = new document();
print $page->getpage_HVZM(PAGEMODE_FULL_NORDITA);
// ===========================================================================
Esempio n. 20
0
<?php

session_start();
include "inc/stdLib.php";
$menu = $_SESSION['menu'];
if ($_POST) {
    require_once "documents.php";
    $dbfile = new document();
    $id = $dbfile->searchDocument($_FILES["Datei"]["name"], $_POST["pfad"]);
    if ($id) {
        $rc = $dbfile->getDokument($id);
    }
    if ($dbfile->lock > 0) {
        echo translate('.:file locked:.', 'firma') . "!";
        $rc = False;
    } else {
        $dbfile->setDocData("descript", $_POST["descript"]);
        $rc = $dbfile->uploadDocument($_FILES, $_POST["upldpath"]);
    }
    if ($rc) {
        ?>
	<script language="JavaScript">
		top.dateibaum('left','<?php 
        echo $_POST["upldpath"];
        ?>
');
        top.document.getElementById("uploadfr").style.visibility = "hidden";
	</script>
<?php 
    }
}
Esempio n. 21
0
<?php

//You'll need to change the password for the database to your root password if you wish to run this locally.
//Also, you need the following rewrite rule in Apache:
//	RewriteEngine on
//	RewriteCond %{REQUEST_URI} !(index\.php|\.svg|\.png|\.jpe?g|\.ico)
//	RewriteRule ^(.+)$ /index.php?page=$1 [L,QSA]
//This required PHP 5.6.6. If you do not have it, the inheritance properties of the class constants will cause it to fail to compile.
namespace {
    document::load();
    class conf
    {
        const js_root = '_.js';
        const css_root = '_.css';
    }
    class document
    {
        /**/
        function mime($c)
        {
            $mime = !strpos($_GET['page'][$c], '.js') && !strpos($_GET['page'][$c], '.css') ? 'html' : (strpos($_GET['page'][$c], '.css') ? 'css' : 'js');
            header("Content-type: text/{$mime}");
            $dot = strpos($_GET['page'][$c], '.');
            if ($dot && $mime === 'html') {
                $_GET['page'][$c] = substr($_GET['page'][$c], 0, $dot);
            }
            return $mime;
        }
        function load()
        {
            $_GET['page'] = explode('/', $_GET['page']);
Esempio n. 22
0
function insWvlM($data, $Flag, $Expunge)
{
    if (empty($data["cp_cv_id"]) && $data['status'] < 1) {
        $kontaktID = $data["CRMUSER"];
        //$data["cp_cv_id"]=$data["CRMUSER"];
    } else {
        $kontaktID = substr($data["cp_cv_id"], 1);
        $kontaktTAB = substr($data["cp_cv_id"], 0, 1);
    }
    if (!empty($kontaktID)) {
        $data["status"] = 0;
        $nun = date("Y-m-d H:i:00");
        $data["kontakt"] = "M";
        $did = false;
        $data["c_cause"] = $data["c_long"];
        $data["cause"] = $data["cause"];
        $data["Bezug"] = 0;
        $data["Kontakt"] = "M";
        $data["Datum"] = date("d.m.Y");
        $data["Zeit"] = date("H:i");
        $CID = $_SESSION["loginCRM"];
        $data["CID"] = $kontaktID;
        $tid = insCall($data, false);
        if (!$tid) {
            return -6;
        }
        if (!empty($data["dateien"])) {
            $data["DateiID"] = true;
            foreach ($data["dateien"] as $mail) {
                //trenne Anhang und speichere in tmp
                $file = explode(",", $mail);
                $Datei["Datei"]["name"] = $file[0];
                $Datei["Datei"]["tmp_name"] = $file[0];
                $Datei["Datei"]["size"] = $file[1];
                $dbfile = new document();
                $dbfile->setDocData("descript", $data["DCaption"]);
                $pfad = mkPfad($data["cp_cv_id"], $data["CRMUSER"]);
                $rc = $dbfile->uploadDocument($Datei, $pfad);
                if (!$rc) {
                    return -8;
                }
                $did = $dbfile->id;
                documenttotc($tid, $did);
            }
            moveMail($data["muid"], $CID, $Flag, $Expunge);
            $sql = "update telcall set dokument=1 where id = {$tid}";
            $rc = $_SESSION['db']->query($sql);
            return $rc;
        } else {
            $data["DateiID"] = false;
            moveMail($data["muid"], $CID, $Flag, $Expunge);
        }
        // bis hier ok
        $rs = 1;
    } else {
        $rs = -7;
    }
    return $rs;
}
Esempio n. 23
0
 /**
  * Adds a file to the search engine.
  *
  * Notes about Solr and Tika indexing. We do not send the mime type, only the filename.
  * Tika has much better content type detection than Moodle, and we will have many more doc failures
  * if we try to send mime types.
  *
  * @param document $document
  * @param \stored_file $storedfile
  * @return void
  */
 protected function add_stored_file($document, $storedfile)
 {
     $filedoc = $document->export_file_for_engine($storedfile);
     if (!$this->file_is_indexable($storedfile)) {
         // For files that we don't consider indexable, we will still place a reference in the search engine.
         $filedoc['solr_fileindexstatus'] = document::INDEXED_FILE_FALSE;
         $this->add_solr_document($filedoc);
         return;
     }
     $curl = $this->get_curl_object();
     $url = $this->get_connection_url('/update/extract');
     // This will prevent solr from automatically making fields for every tika output.
     $url->param('uprefix', 'ignored_');
     // Control how content is captured. This will keep our file content clean of non-important metadata.
     $url->param('captureAttr', 'true');
     // Move the content to a field for indexing.
     $url->param('fmap.content', 'solr_filecontent');
     // These are common fields that matches the standard *_point dynamic field and causes an error.
     $url->param('fmap.media_white_point', 'ignored_mwp');
     $url->param('fmap.media_black_point', 'ignored_mbp');
     // Copy each key to the url with literal.
     // We place in a temp name then copy back to the true field, which prevents errors or Tika overwriting common field names.
     foreach ($filedoc as $key => $value) {
         // This will take any fields from tika that match our schema and discard them, so they don't overwrite ours.
         $url->param('fmap.' . $key, 'ignored_' . $key);
         // Place data in a tmp field.
         $url->param('literal.mdltmp_' . $key, $value);
         // Then move to the final field.
         $url->param('fmap.mdltmp_' . $key, $key);
     }
     // This sets the true filename for Tika.
     $url->param('resource.name', $storedfile->get_filename());
     // A giant block of code that is really just error checking around the curl request.
     try {
         // Now actually do the request.
         $result = $curl->post($url->out(false), array('myfile' => $storedfile));
         $code = $curl->get_errno();
         $info = $curl->get_info();
         // Now error handling. It is just informational, since we aren't tracking per file/doc results.
         if ($code != 0) {
             // This means an internal cURL error occurred error is in result.
             $message = 'Curl error ' . $code . ' while indexing file with document id ' . $filedoc['id'] . ': ' . $result . '.';
             debugging($message, DEBUG_DEVELOPER);
         } else {
             if (isset($info['http_code']) && $info['http_code'] !== 200) {
                 // Unexpected HTTP response code.
                 $message = 'Error while indexing file with document id ' . $filedoc['id'];
                 // Try to get error message out of msg or title if it exists.
                 if (preg_match('|<str [^>]*name="msg"[^>]*>(.*?)</str>|i', $result, $matches)) {
                     $message .= ': ' . $matches[1];
                 } else {
                     if (preg_match('|<title[^>]*>([^>]*)</title>|i', $result, $matches)) {
                         $message .= ': ' . $matches[1];
                     }
                 }
                 // This is a common error, happening whenever a file fails to index for any reason, so we will make it quieter.
                 if (CLI_SCRIPT && !PHPUNIT_TEST) {
                     mtrace($message);
                 }
             } else {
                 // Check for the expected status field.
                 if (preg_match('|<int [^>]*name="status"[^>]*>(\\d*)</int>|i', $result, $matches)) {
                     // Now check for the expected status of 0, if not, error.
                     if ((int) $matches[1] !== 0) {
                         $message = 'Unexpected Solr status code ' . (int) $matches[1];
                         $message .= ' while indexing file with document id ' . $filedoc['id'] . '.';
                         debugging($message, DEBUG_DEVELOPER);
                     } else {
                         // The document was successfully indexed.
                         return;
                     }
                 } else {
                     // We received an unprocessable response.
                     $message = 'Unexpected Solr response while indexing file with document id ' . $filedoc['id'] . ': ';
                     $message .= strtok($result, "\n");
                     debugging($message, DEBUG_DEVELOPER);
                 }
             }
         }
     } catch (\Exception $e) {
         // There was an error, but we are not tracking per-file success, so we just continue on.
         debugging('Unknown exception while indexing file "' . $storedfile->get_filename() . '".', DEBUG_DEVELOPER);
     }
     // If we get here, the document was not indexed due to an error. So we will index just the base info without the file.
     $filedoc['solr_fileindexstatus'] = document::INDEXED_FILE_ERROR;
     $this->add_solr_document($filedoc);
 }
Esempio n. 24
0
function serbrief($data)
{
    $rc = file_exists("../dokumente/" . $_SESSION["dbname"] . "/tmp/" . $data['filename']);
    if ($rc) {
        require_once "documents.php";
        $dest = "./dokumente/" . $_SESSION["dbname"] . "/serbrief/";
        $ok = chkdir("serbrief");
        copy("../dokumente/" . $_SESSION["dbname"] . "/tmp/" . $data['filename'], '.' . $dest . $data['filename']);
        unlink("../dokumente/" . $_SESSION["dbname"] . "/tmp/" . $data['filename']);
        //Verzeichnis anlegen für die Serienbriefe
        @mkdir("." . $dest . substr($_POST['filename'], 0, -4));
        //Dokument in db speichern
        $dbfile = new document();
        $dbfile->setDocData("descript", $data["subject"]);
        $dbfile->setDocData("pfad", "serbrief");
        $dbfile->setDocData("name", $data['filename']);
        $dbfile->setDocData("descript", $data["body"]);
        $rc = $dbfile->newDocument();
        $dbfile->saveDocument();
        //benötigte Daten in Session speichern
        $_SESSION["dateiId"] = $dbfile->id;
        $_SESSION["SUBJECT"] = $_POST["subject"];
        $_SESSION["BODY"] = $_POST["body"];
        $_SESSION["DATE"] = $_POST["datum"];
        $_SESSION["src"] = $_POST["src"];
        $_SESSION["savefiledir"] = $dest . substr($_POST['filename'], 0, -4);
        $_SESSION["datei"] = $_POST['filename'];
        echo json_encode(array('rc' => true, "msg" => "Datei gesichert"));
    } else {
        echo json_encode(array('rc' => false, "msg" => "Fehler beim Upload " . $_POST['filename']));
    }
}
Esempio n. 25
0
 <?php 
$page_title = 'Barangay System';
$stylesheet_link = 'style';
require 'path.php';
init_cobalt();
require 'header1.php';
require_once 'subclasses/document.php';
$dbh_document = new document();
$dbh_document->execute_query("SELECT d.document_name, r.requirement_name FROM document d JOIN requirement r ON d.document_id = r.document_id WHERE is_offered='yes'");
$result = $dbh_document->result;
$document_requirements = array();
while ($row = $result->fetch_assoc()) {
    $document_requirements[] = $row;
}
$dbh_document->execute_query("SELECT DISTINCT document_name, document_description FROM document WHERE is_offered='yes'");
$result = $dbh_document->result;
$documents = array();
while ($row = $result->fetch_assoc()) {
    $documents[] = $row;
}
?>
<main>
	<div class="block-body">
			<h1 class="doc-headings">Listahan ng mga Dokumento</h1><br/><br/>
		<div class="div-list-doc">
			<hr class="hr">
			<center>
			<?php 
foreach ($documents as $row) {
    extract($row);
    echo "<ul class='list-of-doc'>";
Esempio n. 26
0
||										AIMSys - Aircraft Inventory & Maintenance System										||
||										Jeremy Bloomstrom																		||
||										Ingenious Design																		||
||										jeremy@in.genio.us																		||
||										March 27, 2013																			||
||																																||
|________________________________________________________________________________________________________________________________|
||																																||
||																																||
||										default.php																				||
||										VIEW																					||
||										Default view of main controller															||
*********************************************************************************************************************************/
// Do Some Logic stuff
//User Info
$user = $_SESSION;
// Get Session Expiry
$ts = $user['expires'];
$oExpires = new Date($ts);
$year = $oExpires->_format("Y");
$month = $oExpires->_format("n") - 1;
$day = $oExpires->_format("j");
$hour = 1 * $oExpires->_format("H");
$minute = 1 * $oExpires->_format("i");
$second = 1 * $oExpires->_format("s");
$js_date = "{$year},{$month},{$day},{$hour},{$minute},{$second}";
// Get View
$oView = new view($view);
// Display View Script and View HTML
echo document::_addScript($oView->_script());
include_once $oView->_html();
Esempio n. 27
0
<?php

require 'components/get_listview_referrer.php';
require 'subclasses/document.php';
$dbh_document = new document();
$dbh_document->set_where("document_id='" . quote_smart($document_id) . "'");
if ($result = $dbh_document->make_query()->result) {
    $data = $result->fetch_assoc();
    extract($data);
    $data = explode('-', $date_offered);
    if (count($data) == 3) {
        $date_offered_year = $data[0];
        $date_offered_month = $data[1];
        $date_offered_day = $data[2];
    }
}
Esempio n. 28
0
 /**
  * Add the forum post attachments.
  *
  * @param document $document The current document
  * @return null
  */
 public function attach_files($document)
 {
     global $DB;
     $postid = $document->get('itemid');
     try {
         $post = $this->get_post($postid);
     } catch (\dml_missing_record_exception $e) {
         unset($this->postsdata[$postid]);
         debugging('Could not get record to attach files to ' . $document->get('id'), DEBUG_DEVELOPER);
         return;
     }
     // Because this is used during indexing, we don't want to cache posts. Would result in memory leak.
     unset($this->postsdata[$postid]);
     $cm = $this->get_cm('forum', $post->forum, $document->get('courseid'));
     $context = \context_module::instance($cm->id);
     // Get the files and attach them.
     $fs = get_file_storage();
     $files = $fs->get_area_files($context->id, 'mod_forum', 'attachment', $postid, "filename", false);
     foreach ($files as $file) {
         $document->add_stored_file($file);
     }
 }
Esempio n. 29
0
 static function addDocument($options)
 {
     //configure adding doc
     $time_file = date("Y-m-d-H-i");
     $name = "";
     if ($options["itemtype"] == 'Computer') {
         $name = "computer";
     } else {
         if ($options["itemtype"] == 'NetworkEquipment') {
             $name = "networking";
         } else {
             if ($options["itemtype"] == 'Peripheral') {
                 $name = "peripheral";
             } else {
                 if ($options["itemtype"] == 'Monitor') {
                     $name = "monitor";
                 } else {
                     if ($options["itemtype"] == 'Printer') {
                         $name = "printer";
                     } else {
                         if ($options["itemtype"] == 'PluginRacksRack') {
                             $name = "rack";
                         }
                     }
                 }
             }
         }
     }
     $filename = "infocoms_" . $options["suppliername"] . "_" . $name . "_" . $options["ID"] . ".html";
     //on enregistre
     $path = GLPI_DOC_DIR . "/_uploads/";
     $filepath = $path . $filename;
     $datas = array("url" => $options["url"], "download" => true, "file" => $filepath, "suppliername" => $options["suppliername"]);
     self::cURLData($datas);
     $doc = new document();
     $input = array();
     $input["entities_id"] = $options["entities_id"];
     $input["name"] = addslashes("infocoms_" . $options["suppliername"] . "_" . $name . "_" . $options["ID"]);
     $input["upload_file"] = $filename;
     $input["documentcategories_id"] = $options["rubrique"];
     $input["mime"] = "text/html";
     $input["date_mod"] = date("Y-m-d H:i:s");
     $input["users_id"] = Session::getLoginUserID();
     $newdoc = $doc->add($input);
     $docitem = new Document_Item();
     $docitem->add(array('documents_id' => $newdoc, 'itemtype' => $options["itemtype"], 'items_id' => $options["ID"], 'entities_id' => $input["entities_id"]));
     $temp = new PluginManufacturersimportsLog();
     $temp->deleteByCriteria(array('itemtype' => $options["itemtype"], 'items_id' => $options["ID"]));
     return $newdoc;
 }
Esempio n. 30
0
 function generatePdf($itemtype, $data, $saveas)
 {
     global $CFG_GLPI, $PDF, $DB;
     $ID = $data["id"];
     //name
     if (!empty($data["name"])) {
         $name_item = Toolbox::decodeFromUtf8($data["name"]);
     } else {
         $name_item = "";
     }
     //user
     if (!empty($data["users_id"])) {
         $user_item = Toolbox::decodeFromUtf8(Html::clean(getUserName($data["users_id"])));
     } else {
         if (!empty($data["groups_id"])) {
             $user_item = Toolbox::decodeFromUtf8(Dropdown::getDropdownName("glpi_groups", $data["groups_id"]));
         } else {
             $user_item = "";
         }
     }
     //fabricant
     if (!empty($data["manufacturers_id"])) {
         $fabricant_item = Toolbox::decodeFromUtf8(Dropdown::getDropdownName("glpi_manufacturers", $data["manufacturers_id"]));
     } else {
         $fabricant_item = "";
     }
     //serial
     if (!empty($data["serial"])) {
         $serial_item = Toolbox::decodeFromUtf8($data["serial"]);
     } else {
         $serial_item = "";
     }
     $class = $itemtype . "Type";
     $item = new $class();
     $typefield = getForeignKeyFieldForTable(getTableForItemType($itemtype . "Type"));
     $item->getFromDB($data[$typefield]);
     if (!empty($typefield) && !empty($item->fields["name"])) {
         $type_item = Toolbox::decodeFromUtf8($item->fields["name"]);
     } else {
         $type_item = "";
     }
     //infocoms
     $ic = new Infocom();
     if ($ic->getfromDBforDevice($itemtype, $ID)) {
         //immobilizationsheets_item
         if (!empty($ic->fields["immo_number"])) {
             $immobilizationsheets_item = Toolbox::decodeFromUtf8($ic->fields["immo_number"]);
         } else {
             $immobilizationsheets_item = "";
         }
         //buy_date
         if (!empty($ic->fields["buy_date"])) {
             $buy_date_item = Toolbox::decodeFromUtf8(Html::convdate($ic->fields["buy_date"]));
         } else {
             $buy_date_item = "";
         }
         //use_date
         if (!empty($ic->fields["use_date"])) {
             $use_date_item = Toolbox::decodeFromUtf8(Html::convdate($ic->fields["use_date"]));
         } else {
             $use_date_item = "";
         }
         //order_number
         if (!empty($ic->fields["order_number"])) {
             $order_number_item = Toolbox::decodeFromUtf8($ic->fields["order_number"]);
         } else {
             $order_number_item = "";
         }
         //value_item
         if (!empty($ic->fields["value"])) {
             $value_item = Toolbox::decodeFromUtf8(Html::clean(Html::formatNumber($ic->fields["value"])));
         } else {
             $value_item = "";
         }
         //sink_time
         if (!empty($ic->fields["sink_time"])) {
             $sink_time_item = Toolbox::decodeFromUtf8(sprintf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]));
         } else {
             $sink_time_item = "";
         }
         //sink_type
         if (!empty($ic->fields["sink_type"])) {
             $sink_type_item = Toolbox::decodeFromUtf8(Infocom::getAmortTypeName($ic->fields["sink_type"]));
         } else {
             $sink_type_item = "";
         }
     } else {
         $immobilizationsheets_item = "";
         $buy_date_item = "";
         $use_date_item = "";
         $order_number_item = "";
         $value_item = "";
         $sink_time_item = "";
         $sink_type_item = "";
     }
     //composants
     $devtypes = self::getDeviceTypes();
     if ($itemtype == 'Computer') {
         $device2 = new $devtypes[2]();
         $query2 = "SELECT `deviceprocessors_id`\n                  FROM `" . getTableForItemType('items_' . $devtypes[2]) . "`\n                  WHERE `items_id` = '{$ID}'";
         $result2 = $DB->query($query2);
         $number2 = $DB->numrows($result2);
         $device3 = new $devtypes[3]();
         $query3 = "SELECT SUM(`size`) AS total\n                  FROM `" . getTableForItemType('items_' . $devtypes[3]) . "`\n                  WHERE `items_id` = '{$ID}'";
         $result3 = $DB->query($query3);
         $number3 = $DB->numrows($result3);
         $query3b = "SELECT `devicememories_id`\n                  FROM `" . getTableForItemType('items_' . $devtypes[3]) . "`\n                  WHERE `items_id` = '{$ID}'";
         $result3b = $DB->query($query3b);
         $number3b = $DB->numrows($result3b);
         $device4 = new $devtypes[4]();
         $query4 = "SELECT `deviceharddrives_id`,`capacity`\n                  FROM `" . getTableForItemType('items_' . $devtypes[4]) . "`\n                  WHERE `items_id` = '{$ID}'";
         $result4 = $DB->query($query4);
         $number4 = $DB->numrows($result4);
         $device5 = new $devtypes[6]();
         $query5 = "SELECT `devicedrives_id`\n                  FROM `" . getTableForItemType('items_' . $devtypes[6]) . "`\n                  WHERE `items_id` = '{$ID}'";
         $result5 = $DB->query($query5);
         $number5 = $DB->numrows($result5);
         if ($number2 != 0) {
             while ($data2 = $DB->fetch_array($result2)) {
                 //proc_item
                 if (!empty($data2["deviceprocessors_id"])) {
                     $query_proc = "SELECT `designation`\n                              FROM `glpi_deviceprocessors`\n                              WHERE `id` = '" . $data2["deviceprocessors_id"] . "'";
                     $result_proc = $DB->query($query_proc);
                     $number_proc = $DB->numrows($result_proc);
                     if ($number_proc != 0) {
                         while ($data_proc = $DB->fetch_array($result_proc)) {
                             $proc_item = Toolbox::decodeFromUtf8($data_proc["designation"]);
                         }
                     }
                 }
             }
         } else {
             $proc_item = "";
         }
         if ($number3 != 0) {
             while ($data3 = $DB->fetch_array($result3)) {
                 //ram_item
                 $ram_item = $data3["total"];
             }
         } else {
             $ram_item = "";
         }
         $ram_type_item = "";
         if ($number3b != 0) {
             while ($data3b = $DB->fetch_array($result3b)) {
                 //ram_type_item
                 if (!empty($data3b["devicememories_id"])) {
                     $query_ram = "SELECT `glpi_devicememorytypes`.`name`\n                              FROM `glpi_devicememories`,`glpi_devicememorytypes`\n                              WHERE `glpi_devicememories`.`id` = '" . $data3b["devicememories_id"] . "'\n                              AND `glpi_devicememorytypes`.`id` = `glpi_devicememories`.`devicememorytypes_id` ";
                     $result_ram = $DB->query($query_ram);
                     $number_ram = $DB->numrows($result_ram);
                     if ($number_ram != 0) {
                         while ($data_ram = $DB->fetch_array($result_ram)) {
                             $ram_type_item = Toolbox::decodeFromUtf8($data_ram["name"]);
                         }
                     } else {
                         $ram_type_item = "";
                     }
                 }
             }
         } else {
             $ram_type_item = "";
         }
         $hdd_item = "";
         $hdd_designation_item = "";
         $hdd_interface_item = "";
         if ($number4 != 0) {
             while ($data4 = $DB->fetch_array($result4)) {
                 //hdd_item
                 $hdd_size_item = Toolbox::decodeFromUtf8($data4["capacity"]);
                 if (!empty($data4["deviceharddrives_id"])) {
                     $query_hdd = "SELECT `designation`\n                              FROM `glpi_deviceharddrives`\n                              WHERE `id` = '" . $data4["deviceharddrives_id"] . "'";
                     $result_hdd = $DB->query($query_hdd);
                     $number_hdd = $DB->numrows($result_hdd);
                     if ($number_hdd != 0) {
                         while ($data_hdd = $DB->fetch_array($result_hdd)) {
                             $hdd_designation_item = Toolbox::decodeFromUtf8($data_hdd["designation"]);
                         }
                     } else {
                         $hdd_designation_item = "";
                     }
                     $query_hdd1 = "SELECT `glpi_interfacetypes`.`name`\n                              FROM `glpi_deviceharddrives`,`glpi_interfacetypes`\n                              WHERE `glpi_deviceharddrives`.`id` = '" . $data4["deviceharddrives_id"] . "'\n                              AND `glpi_interfacetypes`.`id` = `glpi_deviceharddrives`.`interfacetypes_id` ";
                     //replace interface by FK_interface 0.72.1
                     $result_hdd1 = $DB->query($query_hdd1);
                     $number_hdd1 = $DB->numrows($result_hdd1);
                     if ($number_hdd1 != 0) {
                         while ($data_hdd1 = $DB->fetch_array($result_hdd1)) {
                             $hdd_interface_item = Toolbox::decodeFromUtf8($data_hdd1["name"]);
                         }
                     }
                 } else {
                     $hdd_interface_item = "";
                 }
                 $hdd_item .= $hdd_designation_item . " " . $hdd_interface_item . " (" . $hdd_size_item . " Mo)";
                 if ($number4 > 1) {
                     $hdd_item .= " - ";
                 }
             }
         } else {
             $hdd_item = "";
         }
         $lecteur_item = "";
         if ($number5 != 0) {
             while ($data5 = $DB->fetch_array($result5)) {
                 //lecteur_item
                 if (!empty($data5["items_id"])) {
                     $query_lecteur = "SELECT `designation`\n                                 FROM `glpi_devicedrives`\n                                 WHERE `id` = '" . $data5["interfacetypes_id"] . "'";
                     $result_lecteur = $DB->query($query_lecteur);
                     $number_lecteur = $DB->numrows($result_lecteur);
                     if ($number_lecteur != 0) {
                         while ($data_lecteur = $DB->fetch_array($result_lecteur)) {
                             $lecteur_item .= Toolbox::decodeFromUtf8($data_lecteur["designation"]);
                             if ($number5 > 1) {
                                 $lecteur_item .= " - ";
                             }
                         }
                     }
                 }
             }
         } else {
             $lecteur_item = "";
         }
         //softwares
         $query6 = "SELECT `glpi_softwares`.`name`,`glpi_softwarelicenses`.`softwareversions_id_buy`,`glpi_softwarelicenses`.`serial`\n                  FROM `glpi_softwarelicenses`\n                  INNER JOIN `glpi_computers_softwarelicenses` ON (`glpi_softwarelicenses`.`id` = `glpi_computers_softwarelicenses`.`softwarelicenses_id` AND `glpi_computers_softwarelicenses`.`computers_id` = '{$ID}') \n                  INNER JOIN `glpi_softwares` ON (`glpi_softwarelicenses`.`softwares_id` = `glpi_softwares`.`id`) ";
         $result6 = $DB->query($query6);
         $number6 = $DB->numrows($result6);
     }
     //Affichage
     //$PDF->addJpegFromFile('../pics/immobilizationsheets.jpg',285,785,32,32);
     //title
     $PDF->ezSetDy(-20);
     $title = array(array('' => Toolbox::decodeFromUtf8(__('IDENTIFICATION IMMOBILIZATION SHEET', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'center'));
     $PDF->ezTable($title, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 12, 'showLines' => 0, 'shaded' => 2, 'shadeCol' => array(0.8, 0.8, 0.8), 'shadeCol2' => array(0.8, 0.8, 0.8)));
     $PDF->ezSetDy(-10);
     //partie 1
     $PDF->ezSetDy(-20);
     $title1 = array(array('' => Toolbox::decodeFromUtf8(__('I - PART TO BE FILLED BY THE PERSON IN CHARGE FOR THE PURCHASES', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'left'));
     $PDF->ezTable($title1, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 10, 'showLines' => 0, 'shaded' => 2, 'shadeCol' => array(0.8, 0.8, 0.8), 'shadeCol2' => array(0.8, 0.8, 0.8)));
     $title2 = array(array('' => Toolbox::decodeFromUtf8(__('(transfer the original to the administrator network so computer equipement, the assistant of management in the other cases)', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'left'));
     $PDF->ezTable($title2, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 8, 'showLines' => 0, 'shaded' => 2, 'shadeCol' => array(0.8, 0.8, 0.8), 'shadeCol2' => array(0.8, 0.8, 0.8)));
     $PDF->ezSetDy(-10);
     //Date mise en service
     $PDF->ezText("<u>" . Toolbox::decodeFromUtf8(__('Startup date')) . "</u> : " . $buy_date_item, 8, array("justification" => "left"));
     $PDF->ezSetDy(-10);
     //ligne1 (entreprise / fournisseur)
     $data1 = array(array('0' => Toolbox::decodeFromUtf8(__('MY ENTERPRISE', 'immobilizationsheets')), '1' => Toolbox::decodeFromUtf8(strtoupper(__('Supplier')))));
     $cols1 = array('0' => array('width' => 265, 'justification' => 'center'), '1' => array('width' => 265, 'justification' => 'center'));
     $PDF->ezTable($data1, '', __('COMPUTER IDENTIFICATION', 'immobilizationsheets'), array('showHeadings' => 0, 'cols' => $cols1));
     //ligne2 (4 / 9)
     $data2 = array(array('0' => Toolbox::decodeFromUtf8(__('Assignment number (si non informatique)', 'immobilizationsheets')), '1' => '', '2' => Toolbox::decodeFromUtf8(__('Brand')), '3' => $fabricant_item));
     $cols2 = array('0' => array('width' => 132.5, 'fontSize' => 8, 'justification' => 'left'), '1' => array('width' => 132.5, 'justification' => 'left'), '2' => array('width' => 132.5, 'justification' => 'left'), '3' => array('width' => 132.5, 'justification' => 'left'));
     $PDF->ezTable($data2, '', '', array('showHeadings' => 0, 'cols' => $cols2, 'fontSize' => 8));
     //ligne3 (5 / 10)
     $data3 = array(array('0' => Toolbox::decodeFromUtf8(__('Invoice number')), '1' => $order_number_item, '2' => Toolbox::decodeFromUtf8(__('Type')), '3' => $type_item));
     $cols3 = array('0' => array('width' => 132.5, 'fontSize' => 8, 'justification' => 'left'), '1' => array('width' => 132.5, 'justification' => 'left'), '2' => array('width' => 132.5, 'justification' => 'left'), '3' => array('width' => 132.5, 'justification' => 'left'));
     $PDF->ezTable($data3, '', '', array('showHeadings' => 0, 'cols' => $cols3, 'fontSize' => 8));
     //ligne4 (6 / 11)
     $data4 = array(array('0' => Toolbox::decodeFromUtf8(__('Value')), '1' => $value_item, '2' => Toolbox::decodeFromUtf8(__('Serial Number')), '3' => $serial_item));
     $cols4 = array('0' => array('width' => 132.5, 'fontSize' => 8, 'justification' => 'left'), '1' => array('width' => 132.5, 'justification' => 'left'), '2' => array('width' => 132.5, 'justification' => 'left'), '3' => array('width' => 132.5, 'justification' => 'left'));
     $PDF->ezTable($data4, '', '', array('showHeadings' => 0, 'cols' => $cols4, 'fontSize' => 8));
     //ligne5 (7 / 12)
     $data5 = array(array('0' => Toolbox::decodeFromUtf8(__('Assignment (client / inv. …)', 'immobilizationsheets')), '1' => '', '2' => Toolbox::decodeFromUtf8(__('Permanent number', 'immobilizationsheets')), '3' => $immobilizationsheets_item));
     $cols5 = array('0' => array('width' => 132.5, 'fontSize' => 8, 'justification' => 'left'), '1' => array('width' => 132.5, 'justification' => 'left'), '2' => array('width' => 132.5, 'justification' => 'left'), '3' => array('width' => 132.5, 'justification' => 'left'));
     $PDF->ezTable($data5, '', '', array('showHeadings' => 0, 'cols' => $cols5, 'fontSize' => 8));
     $PDF->ezSetDy(-10);
     //trigramme
     $data6 = array(array('0' => Toolbox::decodeFromUtf8(__('Trigram and visa of the person in charge', 'immobilizationsheets')), '1' => ''));
     $cols6 = array('0' => array('width' => 430, 'fontSize' => 8, 'justification' => 'right'), '1' => array('width' => 100, 'justification' => 'left'));
     $PDF->ezTable($data6, '', '', array('showHeadings' => 0, 'cols' => $cols6, 'xPos' => 'center', 'xOreintation' => 'right', 'fontSize' => 8));
     //partie 2
     $PDF->ezSetDy(-20);
     $title1 = array(array('' => Toolbox::decodeFromUtf8(__('II - PART TO BE FILLED BY THE NETWORK ADMINISTRATOR', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'left'));
     $PDF->ezTable($title1, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 10, 'showLines' => 0, 'shaded' => 2, 'shadeCol' => array(0.8, 0.8, 0.8), 'shadeCol2' => array(0.8, 0.8, 0.8)));
     $title2 = array(array('' => Toolbox::decodeFromUtf8(__('(transfer to the assistant of management)', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'left'));
     $PDF->ezTable($title2, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 8, 'showLines' => 0, 'shaded' => 2, 'shadeCol' => array(0.8, 0.8, 0.8), 'shadeCol2' => array(0.8, 0.8, 0.8)));
     $PDF->ezSetDy(-10);
     //ligne1 (name  / user)
     $data1 = array(array('0' => Toolbox::decodeFromUtf8(__('User name / sector', 'immobilizationsheets')), '1' => $user_item, '2' => Toolbox::decodeFromUtf8(__('Name')), '3' => $name_item));
     $cols1 = array('0' => array('width' => 132.5, 'justification' => 'center'), '1' => array('width' => 132.5, 'justification' => 'center'), '2' => array('width' => 132.5, 'justification' => 'center'), '3' => array('width' => 132.5, 'justification' => 'center'));
     $PDF->ezTable($data1, '', __('PRINCIPAL ASSIGNMENT', 'immobilizationsheets'), array('fontSize' => 8, 'showHeadings' => 0, 'cols' => $cols1));
     $PDF->ezSetDy(-10);
     if ($itemtype == 'Computer') {
         //title config mat?ielle
         $title = array(array('' => Toolbox::decodeFromUtf8(__('HARDWARE CONFIGURATION', 'immobilizationsheets'))));
         $cols = array('' => array('width' => 530, 'justification' => 'center'));
         $PDF->ezTable($title, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 12, 'showLines' => 1));
         $PDF->ezSetDy(-10);
         //ligne1 (processeur  / ram quantit?/ ram type)
         $data1 = array(array('0' => Toolbox::decodeFromUtf8(__('Processor')), '1' => $proc_item, '2' => Toolbox::decodeFromUtf8(__('Memory')), '3' => Toolbox::decodeFromUtf8(__('Quantity', 'immobilizationsheets')), '4' => $ram_item, '5' => Toolbox::decodeFromUtf8(__('Type')), '6' => $ram_type_item));
         $cols1 = array('0' => array('width' => 55, 'justification' => 'center'), '1' => array('width' => 200, 'justification' => 'left'), '2' => array('width' => 55, 'justification' => 'center'), '3' => array('width' => 55, 'justification' => 'center'), '4' => array('width' => 55, 'justification' => 'center'), '5' => array('width' => 55, 'justification' => 'center'), '6' => array('width' => 55, 'justification' => 'center'));
         $PDF->ezTable($data1, '', '', array('fontSize' => 8, 'showHeadings' => 0, 'cols' => $cols1));
         //ligne2 (Disque dur / Lecteur)
         $data1 = array(array('0' => Toolbox::decodeFromUtf8(__('Hard drive')), '1' => $hdd_item, '2' => Toolbox::decodeFromUtf8(__('Drive')), '3' => $lecteur_item));
         $cols1 = array('0' => array('width' => 55, 'justification' => 'center'), '1' => array('width' => 200, 'justification' => 'left'), '2' => array('width' => 55, 'justification' => 'center'), '3' => array('width' => 220, 'justification' => 'center'));
         $PDF->ezTable($data1, '', '', array('fontSize' => 8, 'showHeadings' => 0, 'cols' => $cols1));
         $PDF->ezSetDy(-10);
         //titre suppl?ent
         $PDF->ezText("<u>" . Toolbox::decodeFromUtf8(__('Additional cards or peripherals', 'immobilizationsheets')) . "</u> : ", 8, array("justification" => "left"));
         $PDF->ezSetDy(-10);
         if ($number6 > 0) {
             //title config logicielle
             $title = array(array('' => Toolbox::decodeFromUtf8(__('SOFTWARE CONFIGURATION', 'immobilizationsheets'))));
             $cols = array('' => array('width' => 530, 'justification' => 'center'));
             $PDF->ezTable($title, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 12, 'showLines' => 1));
             $PDF->ezSetDy(-10);
             //titre logiciels
             $PDF->ezText("<u>" . Toolbox::decodeFromUtf8(__('Oem/Delivered software', 'immobilizationsheets')) . "</u> : ", 8, array("justification" => "left"));
             $PDF->ezSetDy(-10);
             //ligne1 (name  / version / licence)
             $data0 = array(array('0' => Toolbox::decodeFromUtf8(__('Name')), '1' => Toolbox::decodeFromUtf8(__('Version')), '2' => Toolbox::decodeFromUtf8(__('License number'))));
             $cols1 = array('0' => array('width' => 240, 'justification' => 'left'), '1' => array('width' => 50, 'justification' => 'center'), '2' => array('width' => 240, 'justification' => 'center'));
             $PDF->ezTable($data0, '', '', array('fontSize' => 8, 'showHeadings' => 0, 'cols' => $cols1));
             while ($data6 = $DB->fetch_array($result6)) {
                 $soft_name_item = $data6["name"];
                 $soft_version_item = Dropdown::getDropdownName("glpi_softwareversions", $data6["softwareversions_id_buy"]);
                 $soft_license_item = $data6["serial"];
                 $data1 = array(array('0' => $soft_name_item, '1' => $soft_version_item, '2' => $soft_license_item));
                 $cols1 = array('0' => array('width' => 240, 'justification' => 'left'), '1' => array('width' => 50, 'justification' => 'center'), '2' => array('width' => 240, 'justification' => 'center'));
                 $PDF->ezTable($data1, '', '', array('fontSize' => 8, 'showHeadings' => 0, 'cols' => $cols1));
             }
             $PDF->ezSetDy(-10);
         }
     }
     //trigramme
     $data6 = array(array('0' => Toolbox::decodeFromUtf8(__('Trigram and visa of the person in charge', 'immobilizationsheets')), '1' => ''));
     $cols6 = array('0' => array('width' => 430, 'fontSize' => 8, 'justification' => 'right'), '1' => array('width' => 100, 'justification' => 'left'));
     $PDF->ezTable($data6, '', '', array('showHeadings' => 0, 'cols' => $cols6, 'xPos' => 'center', 'xOreintation' => 'right', 'fontSize' => 8));
     //partie 3
     $PDF->ezSetDy(-20);
     $title1 = array(array('' => Toolbox::decodeFromUtf8(__('III - PART TO BE FILLED BY THE MANAGEMENT ASSISTANT', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'left'));
     $PDF->ezTable($title1, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 10, 'showLines' => 0, 'shaded' => 2, 'shadeCol' => array(0.8, 0.8, 0.8), 'shadeCol2' => array(0.8, 0.8, 0.8)));
     $title2 = array(array('' => Toolbox::decodeFromUtf8(__('(for checking, visa and classification)', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'left'));
     $PDF->ezTable($title2, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 8, 'showLines' => 0, 'shaded' => 2, 'shadeCol' => array(0.8, 0.8, 0.8), 'shadeCol2' => array(0.8, 0.8, 0.8)));
     $PDF->ezSetDy(-20);
     //title
     $title = array(array('' => Toolbox::decodeFromUtf8(__('CALCULATION OF AMORTIZATION', 'immobilizationsheets'))));
     $cols = array('' => array('width' => 530, 'justification' => 'center'));
     $PDF->ezTable($title, '', '', array('cols' => $cols, 'showHeadings' => 0, 'fontSize' => 12, 'showLines' => 1));
     $PDF->ezSetDy(-10);
     //Base d'amortissement
     $amort0 = array(array('0' => Toolbox::decodeFromUtf8(__('Base amortization', 'immobilizationsheets')), '1' => $sink_type_item));
     $cols1 = array('0' => array('width' => 130, 'fontSize' => 8, 'justification' => 'left'), '1' => array('width' => 400, 'justification' => 'left'));
     $PDF->ezTable($amort0, '', '', array('showHeadings' => 0, 'cols' => $cols1, 'fontSize' => 8, 'showLines' => 0));
     $PDF->ezSetDy(-10);
     //Duree d'amortissement
     $amort1 = array(array('0' => Toolbox::decodeFromUtf8(__('Amortization duration')), '1' => $sink_time_item));
     $cols1 = array('0' => array('width' => 130, 'fontSize' => 8, 'justification' => 'left'), '1' => array('width' => 400, 'justification' => 'left'));
     $PDF->ezTable($amort1, '', '', array('showHeadings' => 0, 'cols' => $cols1, 'fontSize' => 8, 'showLines' => 0));
     $PDF->ezSetDy(-10);
     //Date de debut d'amortissement
     $amort2 = array(array('0' => Toolbox::decodeFromUtf8(__('Date of beginning of amortization', 'immobilizationsheets')), '1' => $use_date_item));
     $cols1 = array('0' => array('width' => 130, 'fontSize' => 8, 'justification' => 'left'), '1' => array('width' => 400, 'justification' => 'left'));
     $PDF->ezTable($amort2, '', '', array('showHeadings' => 0, 'cols' => $cols1, 'fontSize' => 8, 'showLines' => 0));
     $PDF->ezSetDy(-10);
     //visa
     $amort1 = array(array('0' => Toolbox::decodeFromUtf8(__('VISA A.G.', 'immobilizationsheets')), '1' => ""));
     $cols6 = array('0' => array('width' => 430, 'fontSize' => 8, 'justification' => 'right'), '1' => array('width' => 100, 'justification' => 'left'));
     $PDF->ezTable($data6, '', '', array('showHeadings' => 0, 'cols' => $cols6, 'xPos' => 'center', 'xOreintation' => 'right', 'fontSize' => 8));
     //end
     $PDF->addInfo('Author', Toolbox::decodeFromUtf8(Html::clean(getUserName(Session::getLoginUserID()))));
     $config = new PluginImmobilizationsheetsConfig();
     if ($config->getFromDB(1)) {
         if ($saveas == 1) {
             if ($config->fields["use_backup"] == 1) {
                 $path = GLPI_DOC_DIR . "/_uploads/";
                 $time_file = date("Y-m-d-H-i-s");
                 $filename = "immo_" . $time_file . "_" . $data["name"] . ".pdf";
                 $filepath = $path . $filename;
                 $fp = fopen($filepath, 'wb');
                 fwrite($fp, $PDF->output());
                 fclose($fp);
                 $doc = new document();
                 $input = array();
                 $input["entities_id"] = $data["entities_id"];
                 $input["name"] = addslashes(self::getTypeName(1) . " " . $data["name"] . " " . $time_file);
                 $input["upload_file"] = $filename;
                 $input["documentcategories_id"] = $config->fields["documentcategories_id"];
                 $input["type"] = "application/pdf";
                 $input["date_mod"] = date("Y-m-d H:i:s");
                 $input["users_id"] = Session::getLoginUserID();
                 $newdoc = $doc->add($input);
                 $docitem = new Document_Item();
                 $docitem->add(array('documents_id' => $newdoc, 'itemtype' => $itemtype, 'items_id' => $ID, 'entities_id' => $input["entities_id"]));
             }
         }
     }
 }