function admin_menu_function()
{
    //variable that holds the path to the excel sheet
    $xlsPath = site_url() . "/wp-content/plugins/VFB-E2Excel/plugin-parts/export.xlsx";
    if (!isset($_GET['form_id'])) {
        echo "<br>";
        echo "<h1>Please select a form:</h1>";
        //if user didn't select a form display the forms to choose from
        new listForms();
    } else {
        //construct the excel sheet for the chosen form
        $sheet = new export();
        $sheet->viewEntries($_GET['form_id']);
        $sheet->flush2Xls();
        echo "<br>";
        echo "<h1>Click below to download your excel sheet</h1>";
        echo '<a href="' . $xlsPath . ' "><button id="download_all" href="' . $xlsPath . '" >Download all Entries</button></a>';
    }
}
예제 #2
0
<?php

if ($action == 'export') {
    export::exportTables();
}
$DB = dyn::get('DB');
$prefix = strlen($DB['prefix']);
$table = table::factory();
$table->addCollsLayout('*, 215');
$table->addRow()->addCell(lang::get('name'))->addCell(lang::get('exports'));
$table->addSection('tbody');
$table->setSql("SHOW TABLES IN " . sql::$DB_datenbank . " LIKE '" . dyn::get('DB')["prefix"] . "%'");
if ($table->numSql()) {
    while ($table->isNext()) {
        $name = $table->get("Tables_in_" . sql::$DB_datenbank . " (" . dyn::get('DB')["prefix"] . "%)");
        $name = substr($name, $prefix);
        $inputCheckbox = formInput::factory('export[' . $name . ']', $name);
        $inputCheckbox->addAttribute('type', 'checkbox');
        $inputCheckbox->addClass('input-sm');
        $inputCheckbox->autofocus();
        $table->addRow()->addCell($name)->addCell($inputCheckbox->get());
        $table->next();
    }
}
?>
<form action="index.php" method="post">
<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title"><?php 
예제 #3
0
 function getByRefContent($source_id, $notice_id, $uri, $entity)
 {
     global $include_path;
     global $openurl_map;
     $openurl_map = array();
     $params = $this->get_source_params($source_id);
     if ($params["PARAMETERS"]) {
         //Affichage du formulaire avec $params["PARAMETERS"]
         $vars = unserialize($params["PARAMETERS"]);
         foreach ($vars as $key => $val) {
             global ${$key};
             ${$key} = $val;
         }
     }
     require_once $include_path . "/parser.inc.php";
     _parser_($include_path . "/openurl/openurl_mapping.xml", array("ITEM" => "_getMapItem_"), "MAP");
     if ($entity) {
         //récupère les param d'exports
         $export_param = new export_param();
         $param = $export_param->get_parametres($export_param->context);
         //petit nettoyage pour un bon fonctionnement...
         foreach ($param as $key => $value) {
             $param["exp_" . $key] = $param[$key];
         }
         //maintenant que c'est en ordre, on peut y aller!
         $export = new export(array($notice_id), array(), array());
         $export->get_next_notice("", array(), array(), false, $param);
         $elem = new $openurl_map[$uri]['class']($export->xml_array, true);
         $elem->setEntityType($entity);
         print $elem->serialize();
     } else {
         //si on demande pas une entité, c'est un contextObject
         $openurl_param = new openurl_parameters();
         $openurl_param->setParameters($vars);
         $openurl_instance = new openurl_instance($notice_id, 0, $openurl_param->getParameters(), $source_id);
         $openurl_instance->generateContextObject();
         print $openurl_instance->contextObject->serialize();
     }
 }
예제 #4
0
            ${$op} = $corresp_op[$use[0]];
            return $idf;
        }
    }
    return;
}
switch ($command) {
    case "search":
        //print $query."<br />";
        construct_query($query, 0, 0);
        $s = new search();
        $table = $s->make_search();
        //print $s->make_human_query();
        $sql_query = "select notice_id from {$table} limit 100";
        $resultat = @mysql_query($sql_query);
        echo "0@No errors@";
        echo @mysql_num_rows($resultat);
        while (list($id) = @mysql_fetch_row($resultat)) {
            echo "@{$id}";
        }
        break;
    case "get_notice":
        $id = $query;
        $e = new export(array($id));
        $e->get_next_notice();
        $toiso = new xml_unimarc();
        $toiso->XMLtoiso2709_notice($e->notice);
        echo "0@No errors@";
        echo $toiso->notices_[0];
        break;
}
예제 #5
0
    // HTTP/1.0
    header("Content-Type: text/html; charset=UTF-8");
    $folderid = set_get_folderid();
    if ($browser == "netscape" || $browser == "IE") {
        echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>\n";
        echo "<TITLE>Bookmarks</TITLE>\n";
        echo "<H1>Bookmarks</H1>\n";
        echo "<DL><p>\n";
        $export = new export();
        $export->make_tree($folderid);
        echo "</DL><p>\n";
    } else {
        if ($browser == "opera") {
            echo "Opera Hotlist version 2.0\n";
            echo "Options: encoding = utf8, version=3\n\n";
            $export = new export();
            $export->make_tree($folderid);
        }
    }
}
class export
{
    function export()
    {
        global $settings, $browser;
        # collect the folder data
        require_once ABSOLUTE_PATH . "folders.php";
        $this->tree = new folder();
        $this->tree->folders[0] = array('id' => 0, 'childof' => null, 'name' => $settings['root_folder_name']);
        global $username, $mysql;
        $this->browser = $browser;
예제 #6
0
$get_format = $_GET['format'];
$get_file_type = $_GET['filetype'];


$biller = $SI_BILLER->getBiller($_GET['biller_id']);
$customer = customer::get($_GET['customer_id']);

#create PDF name

if ($_GET['stage'] == 2 ) {

	#echo $block_stage2;


	#get the invoice id
	$export = new export();
	$export -> format = 'pdf';
	$export -> file_type = $get_file_type;
	$export -> file_location = 'file';
	$export -> module = 'statement';
	$export -> biller_id = $biller_id;
	$export -> customer_id = $customer_id;
	$export -> start_date = $start_date;
	$export -> end_date = $end_date;
	$export -> show_only_unpaid = $show_only_unpaid;
	$export -> show_only_real = $show_only_real;
	$export -> filter_by_date = $filter_by_date;
	$export -> execute();

	#$attachment = file_get_contents('./tmp/cache/statement_'.$biller_id.'_'.$customer_id.'_'.$start_date.'_'.$end_date.'.pdf');
	$attachment = 'statement_'.$biller_id.'_'.$customer_id.'_'.$start_date.'_'.$end_date.'.pdf';
예제 #7
0
 /**
  *  订单导出
  */
 public function do_export($id = 0)
 {
     // 初始化返回数据
     $return_data = array();
     //请求结构体
     $request_data = array();
     try {
         //权限验证
         role::check('order_export');
         if ($id < 1) {
             throw new MyRuntimeException(Kohana::lang('o_global.data_load_error'), 403);
         }
         if (!$id) {
             throw new MyRuntimeException(Kohana::lang('o_global.data_load_error'), 403);
         }
         if ($_POST) {
             /* 验证是否选择了订单 */
             if (!isset($_POST['order_ids'])) {
                 throw new MyRuntimeException(Kohana::lang('o_order.select_order_export'), 403);
             }
             $order_ids = $this->input->post('order_ids');
             //array(1,2);
             /* 得到当前的导出配置 */
             $data = Myorder_export::instance($id)->get();
             $output_field_ids = unserialize($data['export_ids']);
             /* 导出格式错误 */
             if (!is_array($output_field_ids) || count($output_field_ids) < 1) {
                 throw new MyRuntimeException(Kohana::lang('o_order.order_export_config_error'), 403);
             }
             $xls = export::instance();
             //$xls->debug(true);//开测试模式
             $xls->set_output_field_ids($output_field_ids);
             /* 订单状态,支付状态,物流状态 */
             $order_status = Kohana::config('order.order_status');
             $pay_status = Kohana::config('order.pay_status');
             $ship_status = Kohana::config('order.ship_status');
             $result = array();
             foreach ($order_ids as $order_id) {
                 $order = Myorder::instance($order_id)->get();
                 $shipping_country_name = Mycountry::instance()->get_name_by_iso_code($order['shipping_country']);
                 $billing_country_name = Mycountry::instance()->get_name_by_iso_code($order['billing_country']);
                 $order_products = Myorder_product::instance()->order_product_details(array('order_id' => $order['id']));
                 $order['shipping_country_name'] = $shipping_country_name;
                 $order['billing_country_name'] = $billing_country_name;
                 $order['pay_status_name'] = $pay_status[$order['pay_status']]['name'];
                 $order['ship_status_name'] = $ship_status[$order['ship_status']]['name'];
                 $order['order_status_name'] = $order_status[$order['order_status']]['name'];
                 $order['ip'] = long2ip($order['ip']);
                 if (is_array($order_products) && count($order_products) > 0) {
                     foreach ($order_products as $key => $value) {
                         $order_products[$key]['total'] = round($value['discount_price'] * $value['quantity'] * $order['conversion_rate'], 2);
                     }
                 }
                 $order['product'] = $order_products;
                 $xls->set_order_line($order);
             }
             $xls->output();
             exit;
         }
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         var_dump($return_struct);
         exit;
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template = new View('layout/empty_html');
             $this->template->content = $return_struct['msg'];
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             /* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             /* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
예제 #8
0
 function display($searchResult)
 {
     if ($searchResult) {
         echo "<div id='result' class='search'>";
         echo "<b>Suchergebnis - </b>";
         echo " <i class='normal'>" . count($searchResult) . " Treffer</i>";
         echo form::link("delete", "x", "index.php?action=hidesearch", "close-search");
         action::listit("search", $searchResult);
         foreach ($searchResult as $entry) {
             $nameArray = thesaurus::get_descriptor($entry[ID]);
             export::descriptor($nameArray[ID], session::get("search"), "SHOW");
             echo "<hr>";
         }
         // set parent
         if (session::get(show) != 0) {
             $parent = session::get(show);
         } else {
             $parent = system::getval("val_orderdefault");
         }
         // sugest new entry if orderdefault is set or OB is displayed
         if ($parent) {
             form::insert_entry(array('parent' => $parent, 'action' => 'add', ""), array(), session::get(search));
         } else {
             echo "<p>Kein Oberbegriff für neuen Begriff gesetzt.</p>";
         }
         echo "</div>";
     } else {
         echo "<div id='result' class='search'>";
         echo "<span class='red'>Kein Eintrag gefunden</span>";
         echo form::link("delete", "x", "index.php?action=hidesearch", "close-search");
         // set parent
         if (session::get(show) != 0) {
             $parent = session::get(show);
         } else {
             $parent = system::getval("val_orderdefault");
         }
         // sugest new entry if orderdefault is set or OB is displayed
         if ($parent) {
             form::insert_entry(array('parent' => $parent, 'action' => 'add', ""), array(), session::get(search));
         } else {
             echo "<p>Kein Oberbegriff für neuen Begriff gesetzt.</p>";
         }
         echo "</div>";
     }
 }
 function convert_batch_to_php_array_assoc($notices_to_convert, $target_charset = 'iso-8859-1')
 {
     global $charset;
     if (!$notices_to_convert) {
         //Rien à faire? On fait rien
         return;
     }
     $xmlexport = new export($notices_to_convert);
     $current_notice_id = $xmlexport->notice_list[$xmlexport->current_notice];
     $parametres = array();
     if (is_array($this->params['include_links'])) {
         $parametres = $this->params['include_links'];
     } else {
         if ($this->params["include_links"]) {
             $parametres["genere_lien"] = 1;
             //Notices liées, relations entre notices
             $parametres["mere"] = 1;
             //Exporter les liens vers les notices mères
             $parametres["notice_mere"] = 0;
             //Exporter aussi les notices mères liées
             $parametres["fille"] = 1;
             //Exporter les liens vers les notices filles
             $parametres["notice_fille"] = 0;
             //Exporter aussi les notices filles liées
             $parametres["art_link"] = 1;
             //Exporter les liens vers les articles pour les notices de pério
             $parametres["notice_art"] = 0;
             //Exporter aussi les articles pour les notices de pério
             $parametres["bulletinage"] = 0;
             //Exporter le bulletinage pour les notices de pério
             $parametres["bull_link"] = 1;
             //Exporter les liens vers les bulletins pour les notices d'article
             $parametres["perio_link"] = 1;
             //Exporter les liens vers les périodiques pour les notices d'articles
             $parametres["notice_perio"] = 0;
             //Exporter aussi les périodiques pour les notices d'articles
         }
     }
     if ($this->params["include_authorite_ids"]) {
         $parametres["include_authorite_ids"] = true;
     }
     $parametres["docnum"] = 1;
     $keep_expl = isset($this->params["include_items"]) && $this->params["include_items"];
     while ($xmlexport->get_next_notice("", array(), array(), $keep_expl, $parametres)) {
         $xmlexport->to_raw_array();
         if ($current_notice_id != -1) {
             $xmlexport_notice = $xmlexport->notice;
             $aresult = array();
             $headers = array();
             if (isset($xmlexport_notice['rs']["value"])) {
                 $headers["rs"] = $xmlexport_notice['rs']["value"];
             }
             if (isset($xmlexport_notice['dt']["value"])) {
                 $headers["dt"] = $xmlexport_notice['dt']["value"];
             }
             if (isset($xmlexport_notice['bl']["value"])) {
                 $headers["bl"] = $xmlexport_notice['bl']["value"];
             }
             if (isset($xmlexport_notice['hl']["value"])) {
                 $headers["hl"] = $xmlexport_notice['hl']["value"];
             }
             if (isset($xmlexport_notice['el']["value"])) {
                 $headers["el"] = $xmlexport_notice['el']["value"];
             }
             if (isset($xmlexport_notice['ru']["value"])) {
                 $headers["ru"] = $xmlexport_notice['ru']["value"];
             }
             $aresult["id"] = $current_notice_id;
             $aresult["header"] = $headers;
             $aresult["f"] = array();
             foreach ($xmlexport_notice['f'] as &$af) {
                 if (!isset($af["c"])) {
                     continue;
                 }
                 if (!isset($aresult["f"][$af["c"]])) {
                     $aresult["f"][$af["c"]] = array();
                 }
                 $arf = array();
                 $arf["ind"] = isset($af["ind"]) ? $af["ind"] : "";
                 $arf["id"] = isset($af["id"]) ? $af["id"] : "";
                 if (isset($af["s"])) {
                     foreach ($af["s"] as &$as) {
                         //La classe export exporte ses données dans la charset de la base.
                         //Convertissons si besoin
                         $value = $as["value"];
                         if ($charset != 'utf-8' && $target_charset == 'utf-8') {
                             $value = utf8_encode($value);
                         } else {
                             if ($charset == 'utf-8' && $target_charset != 'utf-8') {
                                 $value = utf8_decode($value);
                             }
                         }
                         if (isset($arf[$as["c"]]) && !is_array($arf[$as["c"]])) {
                             $arf[$as["c"]] = array($arf[$as["c"]]);
                         }
                         if (isset($arf[$as["c"]]) && is_array($arf[$as["c"]])) {
                             $arf[$as["c"]][] = $value;
                         } else {
                             $arf[$as["c"]] = $value;
                         }
                     }
                 } else {
                     if (isset($af["value"])) {
                         $arf["value"] = $af["value"];
                     }
                 }
                 $aresult["f"][$af["c"]][] = $arf;
             }
             $this->results[$current_notice_id] = $aresult;
             $current_notice_id = $xmlexport->notice_list[$xmlexport->current_notice];
         }
     }
 }
예제 #10
0
 function start_export($id_notice, $type_export, $param_export)
 {
     global $i;
     global $param_path;
     global $specialexport;
     global $output_type;
     global $output_params;
     global $step;
     global $export_type;
     global $base_path;
     global $class_path;
     global $include_path;
     global $msg;
     $step = array();
     if ($id_notice) {
         $this->id_notice = $id_notice;
         $this->export_type = $type_export;
         $export_type = $type_export;
         $this->param_export = $param_export;
         //Récupération du répertoire
         $i = 0;
         $param_path = "";
         if (file_exists("{$base_path}/admin/convert/imports/catalog_subst.xml")) {
             $fic_catal = "{$base_path}/admin/convert/imports/catalog_subst.xml";
         } else {
             $fic_catal = "{$base_path}/admin/convert/imports/catalog.xml";
         }
         _parser_($fic_catal, array("ITEM" => "_item_"), "CATALOG");
         //Lecture des paramètres
         _parser_("{$base_path}/admin/convert/imports/" . $param_path . "/params.xml", array("IMPORTNAME" => "_import_name_", "STEP" => "_step_", "OUTPUT" => "_output_", "INPUT" => "_input_"), "PARAMS");
         //Si l'export est spécial, on charge la fonction d'export
         if ($specialexport) {
             require_once "{$base_path}/admin/convert/imports/" . $param_path . "/export.inc.php";
         }
         //En fonction du type de fichier de sortie, inclusion du script de gestion des sorties
         switch ($output_type) {
             case "xml":
                 require_once "{$base_path}/admin/convert/imports/output_xml.inc.php";
                 break;
             case "iso_2709":
                 require_once "{$base_path}/admin/convert/imports/output_iso_2709.inc.php";
                 break;
             case "custom":
                 require_once "{$base_path}/admin/convert/imports/" . $param_path . "/" . $output_params['SCRIPT'];
                 break;
             case "txt":
                 require_once "{$base_path}/admin/convert/imports/output_txt.inc.php";
                 break;
             default:
                 die($msg["export_cant_find_output_type"]);
         }
         $e_notice = array();
         if ($_SESSION["param_export"]["notice_exporte"]) {
             $notice_exporte = $_SESSION["param_export"]["notice_exporte"];
         } else {
             $notice_exporte = array();
         }
         if ($_SESSION["param_export"]["bulletin_exporte"]) {
             $bulletin_exporte = $_SESSION["param_export"]["bulletin_exporte"];
         } else {
             $bulletin_exporte = array();
         }
         if (!$specialexport) {
             $param = new export_param(EXP_DSI_CONTEXT, $this->param_export);
             $e = new export(array($this->id_notice), $notice_exporte, $bulletin_exporte);
             do {
                 $nn = $e->get_next_notice("", "", "", 0, $param->get_parametres($param->context));
                 if ($e->notice) {
                     $e_notice[] = $e->notice;
                 }
             } while ($nn);
             $notice_exporte = $e->notice_exporte;
             $_SESSION["param_export"]["notice_exporte"] = $notice_exporte;
             //Pour les exemplaires de bulletin
             do {
                 $nn = $e->get_next_bulletin("", "", "", 0, $param->get_parametres($param->context));
                 if ($e->notice) {
                     $e_notice[] = $e->notice;
                 }
             } while ($nn);
             $bulletin_exporte = $e->bulletins_exporte;
             $_SESSION["param_export"]["bulletin_exporte"] = $bulletin_exporte;
         } else {
             $e_notice = _export_($this->id_notice);
         }
         if (!is_array($e_notice)) {
             $this->prepared_notice = $e_notice;
             $this->output_notice .= $this->transform();
         } else {
             for ($i = 0; $i < sizeof($e_notice); $i++) {
                 $this->prepared_notice = $e_notice[$i];
                 $this->output_notice .= $this->transform();
             }
         }
     }
 }
예제 #11
0
    $student_names = required_param('student_names', PARAM_RAW);
    $task = required_param('task', PARAM_INT);
    $mode = required_param('mode', PARAM_ALPHA);
    $assessorid = optional_param('assessor_id', 0, PARAM_INT);
    include_once $CFG->dirroot . '/blocks/evalcomix/reports/xls/export_xls.php';
    $report = new export_xls(array('courseid' => $courseid, 'mode' => $mode));
    $params['courseid'] = $courseid;
    $params['student_ids'] = $student_ids;
    $params['student_names'] = $student_names;
    $params['task'] = $task;
    $params['mode'] = $mode;
    if ($assessorid) {
        $params['assessor_id'] = $assessorid;
    }
    $report->send_export($params);
    exit;
}
if (!empty($formdata)) {
    echo $OUTPUT->header();
    include_once $CFG->dirroot . '/blocks/evalcomix/reports/export.php';
    $params['courseid'] = $courseid;
    $params['mode'] = $mode;
    $params['format'] = $formdata['format'];
    $export = new export($params);
    $export->preprocess_data($formdata);
    $export->print_continue();
    $export->display_preview();
    echo $OUTPUT->footer();
} else {
    header("Location:index.php?id={$courseid}&mode={$mode}");
}
예제 #12
0
 function update_entry($_arg, $errorArray)
 {
     if ($id = session::get("show") or hyrarchy::errors($errorArray)) {
         $parentArray = thesaurus::get_descriptor($id);
         if (right::write() and session::get("edit")) {
             echo "<form method='get' name='descriptor' action='index.php'>";
             // basic data
             form::descriptor($id, $parentArray[name], $errorArray[name]);
             form::comment($id, $parentArray[comment], $errorArray[comment]);
             // field(type,name,value,editable,size,format,prefix,postfix,help)
             echo form::field("submit", "", "speichern", "", "", "", "", "save");
             echo form::field("hidden", "id", $id);
             echo form::field("hidden", "action", "update");
             echo "</form>";
             // links
             form::equivalent_links($id);
             form::hyrarchic_links($id);
             form::sub_links($id);
             form::assoc_links($id);
         }
         // display preview
         echo "<div id='preview'>";
         export::descriptor($id, "", "SHOW");
         echo "</div>";
     }
 }
예제 #13
0
</head>


<body>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>

<?php 
foreach ($_GET as $key => $value) {
    ${$key} = $value;
}
foreach ($_POST as $key => $value) {
    ${$key} = $value;
}
//echoalert($_JS);
// connect database
$daba = new database();
$daba->connect("localhost", "iggmp", "1s87J37r0");
$daba->select("thesaurus");
$exportString = export::print_tree($id, $type);
if ($type == "adlib") {
    $extension = ".xml";
} else {
    $extension = ".csv";
}
$path = "import/export" . user::id() . $extension;
$fHandle = fopen($path, "w");
fputs($fHandle, utf8_decode($exportString));
fclose($fHandle);
echo "<a href='{$path}'>{$type} herunterladen</a>";
?>
</body>
예제 #14
0
파일: expl.class.php 프로젝트: hogsim/PMB
 function save_to_agnostic_warehouse($expl_ids = array(), $source_id = 0, $keep_expl = 1)
 {
     global $base_path, $class_path, $include_path, $dbh;
     if (is_array($expl_ids) && count($expl_ids) && $source_id * 1) {
         $export_params = array('genere_lien' => 1, 'notice_mere' => 1, 'notice_fille' => 1, 'mere' => 0, 'fille' => 0, 'bull_link' => 1, 'perio_link' => 1, 'art_link' => 0, 'bulletinage' => 0, 'notice_perio' => 0, 'notice_art' => 0, 'export_only_expl_ids' => $expl_ids);
         $notice_ids = array();
         $bulletin_ids = array();
         $perio_ids = array();
         $q = 'select expl_notice,expl_bulletin,bulletin_notice from exemplaires left join bulletins on expl_bulletin=bulletin_id and expl_bulletin!=0 where expl_id in (' . implode(',', $expl_ids) . ')';
         $r = pmb_mysql_query($q, $dbh);
         if (pmb_mysql_num_rows($r)) {
             while ($row = pmb_mysql_fetch_object($r)) {
                 if ($row->expl_notice) {
                     $notice_ids[] = $row->expl_notice;
                 }
                 if ($row->expl_bulletin) {
                     $bulletin_ids[] = $row->expl_bulletin;
                 }
                 if ($row->bulletin_notice) {
                     $perio_ids[] = $row->bulletin_notice;
                 }
             }
         }
         if (count($notice_ids) || count($bulletin_ids)) {
             require_once $base_path . '/admin/convert/export.class.php';
             require_once $base_path . "/admin/connecteurs/in/agnostic/agnostic.class.php";
             $conn = new agnostic($base_path . '/admin/connecteurs/in/agnostic');
             $source_params = $conn->get_source_params($source_id);
             $export_params['docnum'] = 1;
             $export_params['docnum_rep'] = $source_params['REP_UPLOAD'];
         }
         if (count($notice_ids)) {
             $notice_ids = array_unique($notice_ids);
             $e = new export($notice_ids);
             $records = array();
             do {
                 $nn = $e->get_next_notice('', array(), array(), $keep_expl, $export_params);
                 if ($e->notice) {
                     $records[] = $e->xml_array;
                 }
             } while ($nn);
             $conn->rec_records_from_xml_array($records, $source_id);
         }
         if (count($bulletin_ids)) {
             $bulletin_ids = array_unique($bulletin_ids);
             $perio_ids = array_unique($perio_ids);
             $e = new export($perio_ids);
             $e->expl_bulletin_a_exporter = $bulletin_ids;
             $records = array();
             do {
                 $nn = $e->get_next_bulletin('', array(), array(), $keep_expl, $export_params);
                 if ($e->notice) {
                     $records[] = $e->xml_array;
                 }
             } while ($nn);
             $conn->rec_records_from_xml_array($records, $source_id);
         }
     }
 }
예제 #15
0
<head>
	<TITLE>OpenThesaurus</TITLE>

	<link rel='stylesheet' type='text/css' href='default.css'>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>

<body onload="self.focus(); document.insert.name.focus();">


<script language="JavaScript" src="libjava.js"></script>

<?php 
include "libstd.php";
// connect database
$daba = new database();
$daba->connect("localhost", "iggmp", "1s87J37r0");
$daba->select("thesaurus");
switch ($action) {
    case all:
        export::print_all(session::get("descriptor"));
        break;
    case search:
        export::print_search($filter);
        break;
    default:
        break;
}
?>
</body>
</html>
예제 #16
0
$z = 0;
if ($_SESSION["param_export"]["notice_exporte"]) {
    $notice_exporte = $_SESSION["param_export"]["notice_exporte"];
} else {
    $notice_exporte = array();
}
if ($_SESSION["param_export"]["bulletin_exporte"]) {
    $bulletin_exporte = $_SESSION["param_export"]["bulletin_exporte"];
} else {
    $bulletin_exporte = array();
}
while (list($id) = pmb_mysql_fetch_row($resultat)) {
    if (!$specialexport) {
        $e_notice = array();
        $param = new export_param(EXP_SESSION_CONTEXT);
        $e = new export(array($id), $notice_exporte, $bulletin_exporte);
        do {
            $nn = $e->get_next_notice($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context));
            if ($e->notice) {
                $e_notice[] = $e->notice;
            }
        } while ($nn);
        $notice_exporte = $e->notice_exporte;
        //Pour les exemplaires de bulletin
        do {
            $nn = $e->get_next_bulletin($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context));
            if ($e->notice) {
                $e_notice[] = $e->notice;
            }
        } while ($nn);
        $bulletin_exporte = $e->bulletins_exporte;
예제 #17
0
 function descriptor($id, $highlight = "", $view = "")
 {
     echo "<div id='export'>";
     $dataArray = thesaurus::get_descriptor($id);
     $linkArray = thesaurus::get_link($id, session::get(descriptor));
     $separator = FALSE;
     $isDescriptor = thesaurus::is_descriptor($id);
     //------------------------------------------------------------------------------
     // icons for actions
     echo "<p>";
     if ($view) {
         echo "<div id='box'>";
         echo "<table width='100%'><tr>";
         echo "<td>";
         echo form::link("opentree", "[+]", "index.php?action=showhyrarchy&amp;id={$id}", "opentree");
         // open hyrarchy tree
         echo " " . form::link("edit", "edit", "index.php?action=edit&amp;id={$id}", "edit");
         // link icons
         echo " " . form::link("link", "OB", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=1", "newlink_1");
         echo " " . form::link("equiv", "BS", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=2", "newlink_2");
         echo " " . form::link("assoc", "VB", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=3", "newlink_3");
         echo " " . form::link("add", "add", "index.php?action=add&amp;parent={$id}", "add");
         echo "</td>";
         // print tree
         echo "<td>";
         echo " " . form::link("", "txt", "csv.php?id={$id}&amp;type=txt", "csv");
         echo "</td>";
         // print csv
         echo "<td>";
         echo " " . form::link("", "csv", "csv.php?id={$id}&amp;type=csv", "csv");
         echo "</td>";
         echo "<td align='right'>";
         // export Adlib
         echo "<td>";
         echo " " . form::link("", "adlib", "csv.php?id={$id}&amp;type=adlib", "adlib");
         echo "</td>";
         // set link
         $linkType = session::get(linktype);
         $linkIcon = array("", "dolink", "doequiv", "doassoc");
         if (session::get(link) != $id and session::get(link)) {
             echo "mit <b>'" . thesaurus::name(session::get(link)) . "'</b>' verknüpfen";
             echo " " . form::link($linkIcon[$linkType], $linkType, "index.php?linkaction=linkdo&amp;id={$id}", $linkIcon[$linkType]);
             echo " " . form::link("delete", "end", "index.php?linkaction=linkend", "end-linking");
         }
         echo "</td>";
         echo "</tr></table>";
         echo "</div>";
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // display name
     echo "<p>";
     echo "<span class='exporthead'><b>";
     $tempString = highlight($highlight, $dataArray[name], $isDescriptor);
     echo "<a href='index.php?action=show&amp;id={$id}'>";
     echo $tempString;
     // if javascript -> direkt edit
     if (session::get(JS)) {
     }
     echo grafik::disp("edit", "edit", 15);
     echo "</a>";
     echo "</b>";
     // display status of descriptor
     echo " <i>(" . thesaurus::get_status_name(thesaurus::get_status($id)) . ")</i>";
     // mark if kandidate
     if (!thesaurus::is_visible($id)) {
         echo "<br><span class='red'>versteckt</span>";
     }
     echo "</span>";
     // display type of descriptor
     echo "<br><i>" . thesaurus::get_name(thesaurus::get_thesaurus($id)) . "</i>";
     echo "</p>";
     //------------------------------------------------------------------------------
     // display comment
     echo "<p>";
     if ($dataArray[comment]) {
         echo "<tr><td></td>";
         echo "<td class='export'>";
         echo nl2br(highlight($highlight, $dataArray[comment]));
         echo "</td></tr>";
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // get link data for descriptor
     $parentArray = $linkArray[parent];
     $childArray = $linkArray[child];
     $assocArray = $linkArray[assoc];
     $equivArray = $linkArray[equiv];
     //------------------------------------------------------------------------------
     // list synonyms
     echo "<table>";
     if ($equivArray) {
         // sort for use and used for
         $x = $y = 0;
         foreach ($equivArray as $entry) {
             if ($entry > 0) {
                 $forArray[$x++] = $entry;
             } else {
                 $retArray[$x++] = abs($entry);
             }
         }
         if ($forArray) {
             echo "<tr><td valign='top'>BS</td>";
             echo "<td class='export'>";
             export::list_names($forArray, $highlight);
             echo "</td></tr>";
         }
         if ($retArray) {
             echo "<tr><td valign='top'>BF</td>";
             echo "<td class='export'>";
             export::list_names($retArray, $highlight);
             echo "</td></tr>";
         }
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // list parents
     if ($parentArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("OB", "");
         echo ">OB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($parentArray, $highlight);
         echo "</td></tr>";
     }
     //------------------------------------------------------------------------------
     // list childs
     if ($childArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("UB", "");
         echo ">UB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($childArray, $highlight);
         echo "</td></tr>";
     }
     //------------------------------------------------------------------------------
     // list associative links
     if ($assocArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("VB", "");
         echo ">VB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($assocArray, $highlight);
         echo "</td></tr>";
     }
     echo "</table>";
     echo "</div>";
 }
 function fetch_data()
 {
     //si on a rien, on peut pas travailler...
     if (!$this->notice_id && !$this->notice_externe_id) {
         return false;
     }
     if ($this->notice_id) {
         //pour une notice de la base...
         //récupère les param d'exports
         $export_param = new export_param();
         $param = $export_param->get_parametres($export_param->context);
         //petit nettoyage pour un bon fonctionnement...
         foreach ($param as $key => $value) {
             $param[str_replace("export_", "", $key)] = $param[$key];
         }
         //maintenant que c'est en ordre, on peut y aller!
         $export = new export(array($this->notice_id), array(), array());
         $export->get_next_notice("", array(), array(), false, $param);
         $this->notice_infos = $export->xml_array;
         //on regarde si on veut aussi les infos de la notice contenante...
         if ($this->params['entities']['referring_entity']['allow'] == "yes") {
             //il nous faut déjà l'identifiant du parent, s'il existe...
             $this->parent_id = 0;
             switch ($this->notice_infos['bl']['value'] . $this->notice_infos['hl']['value']) {
                 case "a2":
                 case "s2":
                     $field = "461";
                     break;
                 default:
                     $field = "463";
                     break;
             }
             foreach ($this->notice_infos['f'] as $f) {
                 switch ($f['c']) {
                     case $field:
                         foreach ($f['s'] as $s) {
                             switch ($s['c']) {
                                 case "9":
                                     if (strpos($s['value'], "id:") !== false) {
                                         $this->parent_id = str_replace("id:", "", $s['value']);
                                     }
                                     break;
                             }
                         }
                         break;
                 }
             }
             if ($this->parent_id) {
                 $export_parent = new export(array($this->parent_id), array(), array());
                 $export_parent->get_next_notice("", array(), array(), false, $param);
                 $this->parent_infos = $export_parent->xml_array;
             }
         }
     } else {
         //pour une notice externe
         //TODO : récup notice infos
     }
     //on récup la sérialization pour gérer nos objets
     switch ($this->params['serialization']) {
         case "kev":
         default:
             $this->serialization = "kev_mtx";
             break;
     }
 }
예제 #19
0
 function get_notice_externe($notice_id)
 {
     global $charset, $msg;
     $memo = array();
     $notice_extern_to_memo = array();
     $notice_uni = $this->info['notice_base'];
     $req = "select * from notices where notice_id=" . $notice_id . " ";
     $resultat = pmb_mysql_query($req);
     if ($r = pmb_mysql_fetch_object($resultat)) {
         $code = $r->code;
         $notice_extern = $this->info['harvest']->havest_notice($code, $notice_id);
         //			printr($notice_extern);
         //			printr($notice_uni);
         $cpt = 0;
         foreach ($notice_extern as $contens) {
             $cpt++;
             $profil = $this->info['profil']->info['fields'][$contens['xml_id']];
             // $pmb_fields=$this->info['harvest']->fields_id[$contens['xml_id']];
             //printr($pmb_fields);
             $harvest = $this->info['harvest']->info['fields'][$contens['xml_id']];
             if ($profil) {
                 if ($profil['flagtodo'] == 1) {
                     // on remplace les champs par les nouvelles valeurs
                     foreach ($notice_uni['f'] as $index => $uni_field) {
                         //							printr($contens);
                         //							printr($uni_field);
                         if ($contens['pmb_unimacfield'] && $uni_field['c'] == $contens['pmb_unimacfield'] && $contens['pmb_unimacsubfield']) {
                             // si champ et sous champ, on delete les anciens champs/sous-champ
                             foreach ($uni_field['s'] as $cpt => $ss_field) {
                                 if ($ss_field['c'] == $contens['pmb_unimacsubfield']) {
                                     array_splice($notice_uni['f'][$index]['s'], $cpt, 1);
                                 }
                             }
                             if (!count($uni_field['s'])) {
                                 array_splice($notice_uni['f'], $index, 1);
                             }
                         } elseif ($contens['pmb_unimacfield'] && $uni_field['c'] == $contens['pmb_unimacfield']) {
                             // si pas de sous champ on efface tout
                             array_splice($notice_uni['f'], $index, 1);
                         }
                     }
                 }
                 if ($profil['flagtodo'] == 1 || $profil['flagtodo'] == 2) {
                     $notice_extern_to_memo[] = $contens;
                 }
             }
         }
         //printr($notice_uni);
         //printr($notice_extern_to_memo);
         // Pour tout les champs nouveau à insérer
         $memo_prev = array();
         foreach ($notice_extern_to_memo as $contens) {
             $nb = count($notice_uni['f']);
             $flag_create_unimacfield = 0;
             if ($contens['num_source'] != $memo_prev['num_source']) {
                 $flag_create_unimacfield = 1;
             }
             if ($contens['pmb_unimacfield'] != $memo_prev['pmb_unimacfield']) {
                 $flag_create_unimacfield = 1;
             }
             if ($contens['field_order'] != $memo_prev['field_order']) {
                 $flag_create_unimacfield = 1;
             }
             if ($flag_create_unimacfield) {
                 $index = $nb;
             } else {
                 $index = $memo_prev['i'];
             }
             $notice_uni['f'][$index]['c'] = $contens['pmb_unimacfield'];
             $notice_uni['f'][$index]['ind'] = $contens['field_ind'];
             if ($contens['pmb_unimacsubfield']) {
                 $sschamp = $contens['pmb_unimacsubfield'];
             } else {
                 $sschamp = $contens['usubfield'];
             }
             $nb_ss = count($notice_uni['f'][$index]['s']);
             $notice_uni['f'][$index]['s'][$nb_ss]['c'] = $sschamp;
             $notice_uni['f'][$index]['s'][$nb_ss]['value'] = $contens['value'];
             $memo_prev = $contens;
             $memo_prev['i'] = $index;
             // $memo de l'enregistrement en cours
             //			printr($memo_prev);
         }
     } else {
         //notice inexistante
         return "";
     }
     // printr($notice_uni);
     // conversion du tableau en xml
     $export = new export($notice_id);
     $export->xml_array = $notice_uni;
     $export->toxml();
     $notice_xml = $export->notice;
     // conversion du xml en unimarc
     $xml_unimarc = new xml_unimarc();
     $xml_unimarc->XMLtoiso2709_notice($notice_xml, $charset);
     $notice = $xml_unimarc->notices_[0];
     $z = new z3950_notice("unimarc", $notice);
     $z->libelle_form = $msg["notice_connecteur_remplace_catal"];
     if ($z->bibliographic_level == "a" && $z->hierarchic_level == "2") {
         // article
         //$form=$z->get_form("catalog.php?categ=update&id=".$notice_id,$notice_id,'button',true);
     } else {
         $form = $z->get_form("catalog.php?categ=harvest&action=record&notice_id=" . $notice_id, $notice_id, 'button');
     }
     $form = str_replace("<!--!!form_title!!-->", "<h3>" . sprintf($msg["harvest_notice_build_title"], $notice_id, $item) . "</h3>", $form);
     print $form;
 }
예제 #20
0
 function save_to_agnostic_warehouse($notice_ids = array(), $source_id = 0, $keep_expl = 0)
 {
     global $base_path, $class_path, $include_path;
     if (is_array($notice_ids) && count($notice_ids) && $source_id * 1) {
         $export_params = array('genere_lien' => 1, 'notice_mere' => 1, 'notice_fille' => 1, 'mere' => 0, 'fille' => 0, 'bull_link' => 1, 'perio_link' => 1, 'art_link' => 0, 'bulletinage' => 0, 'notice_perio' => 0, 'notice_art' => 0);
         require_once $base_path . '/admin/convert/export.class.php';
         require_once $base_path . "/admin/connecteurs/in/agnostic/agnostic.class.php";
         $conn = new agnostic($base_path . '/admin/connecteurs/in/agnostic');
         $source_params = $conn->get_source_params($source_id);
         $export_params['docnum'] = 1;
         $export_params['docnum_rep'] = $source_params['REP_UPLOAD'];
         $notice_ids = array_unique($notice_ids);
         $e = new export($notice_ids);
         $records = array();
         do {
             $nn = $e->get_next_notice('', array(), array(), $keep_expl, $export_params);
             if ($e->notice) {
                 $records[] = $e->xml_array;
             }
         } while ($nn);
         $conn->rec_records_from_xml_array($records, $source_id);
     }
 }
예제 #21
0
 static function build_notification($module, $fields, $data_full, $data, $id, $data_row = array())
 {
     if (!is_numeric($data_full["folder"])) {
         $folder_title = basename($data_full["folder"]);
     } else {
         $folder_title = db_select_value("simple_sys_tree", "ftitle", array("id=@id@"), array("id" => $data_full["folder"]));
     }
     if (!empty($data_full["folder"])) {
         $details = "http" . (sys_https() ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER["SCRIPT_NAME"]);
         $details .= "/index.php?view=details&folder=" . $data_full["folder"] . "&item%5B%5D=" . $id;
     } else {
         $details = "";
     }
     $message = substr($data["history"], 0, strpos($data["history"], "\n")) . "\n\n";
     if (!empty($data_full["notification_summary"])) {
         $message .= "{t}Summary{/t}: " . trim($data_full["notification_summary"]) . "\n\n";
     }
     $title = "";
     foreach ($data_full as $key => $value) {
         if (!isset($data[$key]) and !isset($fields[$key]["REQUIRED"])) {
             continue;
         }
         if (!isset($fields[$key]["DISPLAYNAME"]) or !empty($fields[$key]["NO_SEARCH_INDEX"])) {
             continue;
         }
         if (is_array($value)) {
             $value = implode("|", $value);
         }
         if ($key != "notification_summary" and strlen($value) > 0) {
             if (!isset($data_row[$key])) {
                 $data_row[$key] = "";
             }
             $value = trim(self::build_history($fields[$key]["SIMPLE_TYPE"], $value, $data_row[$key]));
             if ($value != "") {
                 $message .= $fields[$key]["DISPLAYNAME"] . ": " . $value . "\n";
                 if ($title == "") {
                     $title = $fields[$key]["DISPLAYNAME"] . ": " . $value;
                 }
             }
         }
     }
     if ($details) {
         $message .= "\n{t}Details{/t}:\n" . $details;
     }
     $attachment = "";
     if ($module == "simple_calendar" and !empty($GLOBALS["t"])) {
         $attachment = implode("", sys_build_filename("invite.ics"));
         $ical_data = array();
         foreach ($data_full as $key => $val) {
             $ical_data[$key] = array("data" => (array) $val, "filter" => (array) $val);
         }
         $ical_data["_id"] = $id;
         file_put_contents($attachment, export::icalendar_data($ical_data), LOCK_EX);
     }
     $smtp_data = array("efrom" => "", "eto" => $data_full["notification"], "subject" => SMTP_NOTIFICATION . " - " . $folder_title . " - " . $title, "message" => $message, "attachment" => $attachment, "folder" => $data_full["folder"]);
     return $smtp_data;
 }
예제 #22
0
 public function run()
 {
     global $db;
     $today = date('Y-m-d');
     $cron = new cron();
     $data = $cron->select_crons_to_run();
     $return['cron_message'] = "Cron started";
     $number_of_crons_run = "0";
     $cron_log = new cronlog();
     $cron_log->run_date = $today;
     foreach ($data as $key => $value) {
         $cron->domain_id = $value['domain_id'];
         $cron_log->cron_id = $value['id'];
         $cron_log->domain_id = $domain_id = $value['domain_id'];
         $check_cron_log = $cron_log->check();
         $i = "0";
         if ($check_cron_log == 0) {
             //only proceed if cron has not been run for today
             $run_cron = false;
             $start_date = date('Y-m-d', strtotime($value['start_date']));
             $end_date = $value['end_date'];
             // Seconds in a day = 60 * 60 * 24 = 86400
             $diff = number_format((strtotime($today) - strtotime($start_date)) / 86400, 0);
             //only check if diff is positive
             if ($diff >= 0 and ($end_date == "" or $end_date >= $today)) {
                 if ($value['recurrence_type'] == 'day') {
                     $modulus = $diff % $value['recurrence'];
                     if ($modulus == 0) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron does not runs TODAY-days";
                     }
                 }
                 if ($value['recurrence_type'] == 'week') {
                     $period = 7 * $value['recurrence'];
                     $modulus = $diff % $period;
                     if ($modulus == 0) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron is not runs TODAY-week";
                     }
                 }
                 if ($value['recurrence_type'] == 'month') {
                     $start_day = date('d', strtotime($value['start_date']));
                     $start_month = date('m', strtotime($value['start_date']));
                     $start_year = date('Y', strtotime($value['start_date']));
                     $today_day = date('d');
                     $today_month = date('m');
                     $today_year = date('Y');
                     $months = $today_month - $start_month + 12 * ($today_year - $start_year);
                     $modulus = $months % $value['recurrence'];
                     if ($modulus == 0 and $start_day == $today_day) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron is not runs TODAY-month";
                     }
                 }
                 if ($value['recurrence_type'] == 'year') {
                     $start_day = date('d', strtotime($value['start_date']));
                     $start_month = date('m', strtotime($value['start_date']));
                     $start_year = date('Y', strtotime($value['start_date']));
                     $today_day = date('d');
                     $today_month = date('m');
                     $today_year = date('Y');
                     $years = $today_year - $start_year;
                     $modulus = $years % $value['recurrence'];
                     if ($modulus == 0 and $start_day == $today_day and $start_month == $today_month) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron is not runs TODAY-year";
                     }
                 }
                 //run the recurrence for this invoice
                 if ($run_cron) {
                     $number_of_crons_run++;
                     $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " - Cron for " . $value['index_name'] . " with start date of " . $value['start_date'] . ", end date of " . $value['end_date'] . " where it runs each " . $value['recurrence'] . " " . $value['recurrence_type'] . " was run today :: Info diff=" . $diff;
                     $i++;
                     $ni = new invoice();
                     $ni->id = $value['invoice_id'];
                     $ni->domain_id = $domain_id;
                     // $domain_id gets propagated from invoice to be copied from
                     $new_invoice_id = $ni->recur();
                     //insert into cron_log date of run
                     //$cron_log = new cronlog();
                     //$cron_log->run_date = $today;
                     //$cron_log->domain_id = $domain_id;
                     //$cron_log->cron_id = $value['cron_id'];
                     $cron_log->insert();
                     ## email the people
                     $invoiceobj = new invoice();
                     $invoice = $invoiceobj->select($new_invoice_id, $domain_id);
                     $preference = getPreference($invoice['preference_id'], $domain_id);
                     $biller = getBiller($invoice['biller_id'], $domain_id);
                     $customer = getCustomer($invoice['customer_id'], $domain_id);
                     #print_r($customer);
                     #create PDF nameVj
                     $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
                     $pdf_file_name_invoice = $spc2us_pref . ".pdf";
                     // email invoice
                     if ($value['email_biller'] == "1" or $value['email_customer'] == "1") {
                         $export = new export();
                         $export->domain_id = $domain_id;
                         $export->format = "pdf";
                         $export->file_location = 'file';
                         $export->module = 'invoice';
                         $export->id = $invoice['id'];
                         $export->execute();
                         #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
                         $email = new email();
                         $email->domain_id = $domain_id;
                         $email->format = 'cron_invoice';
                         $email_body = new email_body();
                         $email_body->email_type = 'cron_invoice';
                         $email_body->customer_name = $customer['name'];
                         $email_body->invoice_name = $invoice['index_name'];
                         $email_body->biller_name = $biller['name'];
                         $email->notes = $email_body->create();
                         $email->from = $biller['email'];
                         $email->from_friendly = $biller['name'];
                         $email->to = $this->getEmailSendAddresses($value, $customer['email'], $biller['email']);
                         $email->invoice_name = $invoice['index_name'];
                         $email->subject = $email->set_subject();
                         $email->attachment = $pdf_file_name_invoice;
                         $return['email_message'] = $email->send();
                     }
                     //Check that all details are OK before doing the eway payment
                     $eway_check = new eway();
                     $eway_check->domain_id = $domain_id;
                     $eway_check->invoice = $invoice;
                     $eway_check->customer = $customer;
                     $eway_check->biller = $biller;
                     $eway_check->preference = $preference;
                     $eway_pre_check = $eway_check->pre_check();
                     //do eway payment
                     if ($eway_pre_check == 'true') {
                         // input customerID,  method (REAL_TIME, REAL_TIME_CVN, GEO_IP_ANTI_FRAUD) and liveGateway or not
                         $eway = new eway();
                         $eway->domain_id = $domain_id;
                         $eway->invoice = $invoice;
                         $eway->biller = $biller;
                         $eway->customer = $customer;
                         $payment_done = $eway->payment();
                         $payment_id = $db->lastInsertID();
                         $pdf_file_name_receipt = 'payment' . $payment_id . '.pdf';
                         if ($payment_done == 'true') {
                             //do email of receipt to biller and customer
                             if ($value['email_biller'] == "1" or $value['email_customer'] == "1") {
                                 /*
                                  * If you want a new copy of the invoice being emailed to the customer 
                                  * use this code
                                  */
                                 $export_rec = new export();
                                 $export_rec->domain_id = $domain_id;
                                 $export_rec->format = "pdf";
                                 $export_rec->file_location = 'file';
                                 $export_rec->module = 'invoice';
                                 $export_rec->id = $invoice['id'];
                                 $export_rec->execute();
                                 #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
                                 $email_rec = new email();
                                 $email_rec->domain_id = $domain_id;
                                 $email_rec->format = 'cron_invoice';
                                 $email_body_rec = new email_body();
                                 $email_body_rec->email_type = 'cron_invoice_receipt';
                                 $email_body_rec->customer_name = $customer['name'];
                                 $email_body_rec->invoice_name = $invoice['index_name'];
                                 $email_body_rec->biller_name = $biller['name'];
                                 $email_rec->notes = $email_body_rec->create();
                                 $email_rec->from = $biller['email'];
                                 $email_rec->from_friendly = $biller['name'];
                                 $email_rec->to = $this->getEmailSendAddresses($value, $customer['email'], $biller['email']);
                                 $email_rec->invoice_name = $invoice['index_name'];
                                 $email_rec->attachment = $pdf_file_name_invoice;
                                 $email_rec->subject = $email_rec->set_subject('invoice_eway_receipt');
                                 $return['email_message'] = $email_rec->send();
                                 /*
                                  * If you want a receipt as PDF being emailed to the customer
                                  * uncomment the code below
                                  */
                                 /*
                                 $export = new export();
                                 $export -> format = "pdf";
                                 $export -> file_location = 'file';
                                 $export -> module = 'payment';
                                 $export -> id = $payment_id;
                                 $export -> execute();
                                 
                                 $email = new email();
                                 $email -> format = 'cron_payment';
                                 
                                     $email_body = new email_body();
                                     $email_body->email_type = 'cron_payment';
                                     $email_body->customer_name = $customer['name'];
                                     $email_body->invoice_name = 'payment'.$payment_id;
                                     $email_body->biller_name = $biller['name'];
                                 
                                 $email -> notes = $email_body->create();
                                 $email -> from = $biller['email'];
                                 $email -> from_friendly = $biller['name'];
                                 if($value['email_customer'] == "1")
                                 {
                                     $email -> to = $customer['email'];
                                 }
                                 if($value['email_biller'] == "1" AND $value['email_customer'] == "1")
                                 {
                                     $email -> to = $customer['email'].";".$biller['email'];
                                 }
                                 if($value['email_biller'] == "1" AND $value['email_customer'] == "0")
                                 {
                                     $email -> to = $customer['email'];
                                 }
                                 $email -> subject = $pdf_file_name_receipt." from ".$biller['name'];
                                 $email -> attachment = $pdf_file_name_receipt;
                                 $return['email_message'] = $email->send();
                                 */
                             }
                         } else {
                             //do email to biller/admin - say error
                             $email = new email();
                             $email->domain_id = $domain_id;
                             $email->format = 'cron_payment';
                             $email->from = $biller['email'];
                             $email->from_friendly = $biller['name'];
                             $email->to = $biller['email'];
                             $email->subject = "Payment failed for " . $invoice['index_name'];
                             $error_message = "Invoice:  " . $invoice['index_name'] . "<br /> Amount: " . $invoice['total'] . " <br />";
                             foreach ($eway->get_message() as $key => $value) {
                                 $error_message .= "\n<br>\$ewayResponseFields[\"{$key}\"] = {$value}";
                             }
                             $email->notes = $error_message;
                             $return['email_message'] = $email->send();
                         }
                     }
                 } else {
                     //cron not run for this cron_id
                     $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " NOT RUN: Cron for " . $value['index_name'] . " with start date of " . $value['start_date'] . ", end date of " . $value['end_date'] . " where it runs each " . $value['recurrence'] . " " . $value['recurrence_type'] . " did not recur today :: Info diff=" . $diff;
                 }
             } else {
                 //days diff is negative - whats going on
                 $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " NOT RUN: - Not cheduled for today - Cron for " . $value['index_name'] . " with start date of " . $value['start_date'] . ", end date of " . $value['end_date'] . " where it runs each " . $value['recurrence'] . " " . $value['recurrence_type'] . " did not recur today :: Info diff=" . $diff;
             }
         } else {
             // cron has already been run for that cron_id today
             $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " - Cron has already been run for domain: " . $domain_id . " for the date: " . $today . " for invoice " . $value['invoice_id'];
             $return['email_message'] = "";
         }
     }
     // no crons scheduled for today
     if ($number_of_crons_run == '0') {
         $return['id'] = $i;
         $return['cron_message'] = "No invoices recurred for this cron run for domain: " . $domain_id . " for the date: " . $today;
         $return['email_message'] = "";
     }
     //insert into cron_log date of run
     /*
     		    $cron_log = new cronlog();
         $cron_log->run_date = $today;
         $cron_log->domain_id = $domain_id;
         $cron_log->insert();
     */
     /*
      * If you want to get an email once cron has been run edit the below details
      *
      */
     /*
         $email = new email();
         $email -> format = 'cron';
         #$email -> notes = $return;
         $email -> from = "simpleinvoices@localhost";
         $email -> from_friendly = "Simple Invoices - Cron";
         $email -> to = "simpleinvoices@localhost";
         #$email -> bcc = $_POST['email_bcc'];
         $email -> subject = "Cron for Simple Invoices has been run for today:";
         $email -> send ();
     */
     return $return;
 }
예제 #23
0
파일: export.php 프로젝트: eistr2n/lansuite
<?php

switch ($_GET['step']) {
    default:
        $dsp->NewContent(t('Bugtracker Export'), t('Nutze diese Funktion um einen Export der Bugtracker-Einträge zu erstellen, den sie auf lansuite.de importieren können'));
        $dsp->AddDoubleRow('', t('Bitte versuche Fehler zunächst selbst zu beheben und filter vor dem Export Probleme aus, die nicht von generellem Interesse für Lansuite sind. Es werden nur Probleme mit Status offen, oder bestätigt exportiert. Ergänze unvollständige Angaben, so gut du kannst. Danke, für die Hilfe!'));
        $dsp->SetForm('index.php?mod=bugtracker&action=export&step=2');
        $dsp->AddTextFieldRow('version', t('Version'), $config['lansuite']['version'], '');
        $dsp->AddTextFieldRow('url', t('URL'), $_SERVER['SERVER_NAME'], '');
        $dsp->AddFormSubmitRow('next');
        $dsp->AddContent();
        break;
    case 2:
        include_once 'modules/install/class_export.php';
        $export = new export();
        $export->LSTableHead('bugs.xml');
        $entrys = '';
        $res = $db->qry("SELECT * FROM %prefix%bugtracker WHERE state = 0 OR state = 1");
        while ($row = $db->fetch_array($res)) {
            $entry = '';
            $data = '';
            $data .= $xml->write_tag('caption', $row['caption'], 4);
            $data .= $xml->write_tag('text', $row['text'], 4);
            $data .= $xml->write_tag('version', $_POST['version'], 4);
            $data .= $xml->write_tag('url', $_POST['url'], 4);
            $data .= $xml->write_tag('priority', $row['priority'], 4);
            $data .= $xml->write_tag('date', $row['date'], 4);
            $data .= $xml->write_tag('type', $row['type'], 4);
            $data .= $xml->write_tag('module', $row['module'], 4);
            $data .= $xml->write_tag('state', $row['state'], 4);
            $entry .= $xml->write_master_tag('main', $data, 3);