deployed webcraft billing satelite to danube

This commit is contained in:
Ulf Gebhardt 2014-05-25 03:24:49 +02:00
parent 48d78ac5c2
commit 0e9c11a001
16 changed files with 150 additions and 102 deletions

View File

@ -15,4 +15,5 @@ $danube_config = array( array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_ERRORREP
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT, '<a href="http://www.mojotrollz.eu/web/danube/" target="_blank">danube</a>, &copy; WebCraft Media 2013'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL, '../system/'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS, array('deDE', 'enUS', 'huHU')),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG, 'deDE'));
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG, 'deDE'),
array(config_ids::WEBCRAFT_BILLING_TOKEN, 'DANUBEdhasda3afdsjadfa3'));

View File

@ -7,4 +7,5 @@ require_once dirname(__FILE__).'/dbd/autoload.inc.php';
require_once dirname(__FILE__).'/api/autoload.inc.php';
require_once dirname(__FILE__).'/files/autoload.inc.php';
require_once dirname(__FILE__).'/files/autoload.inc.php';
require_once dirname(__FILE__).'/config/autoload.inc.php';

View File

@ -0,0 +1,2 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'');

View File

@ -0,0 +1,5 @@
<?php
class config_ids extends \SYSTEM\CONFIG\config_ids {
const WEBCRAFT_BILLING_TOKEN = 1000;
}

5
danube/path/PSAI.php Normal file
View File

@ -0,0 +1,5 @@
<?php
class PSAI extends \SYSTEM\PATH {
public static function getPath(){
return \SYSTEM\C_ROOT.'danube/sai/'.\SYSTEM\C_SUBPATH;}
}

View File

@ -1,3 +1,2 @@
<?php
SYSTEM\autoload::registerFolder(dirname(__FILE__).'','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_dasense_quality_management','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_webcraft_billing_satelite','');

View File

@ -1,2 +1,2 @@
<?php
//\SYSTEM\SAI\sai::register('saimod_dasense_quality_management');
\SYSTEM\SAI\sai::register('saimod_webcraft_billing_satelite');

View File

@ -1,35 +0,0 @@
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title>da_sense | Quality management</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="main">
<div class="masthead">
<h3 class="muted">Quality management</h3>
</div>
<hr>
<div class="tabbable tabs-left">
<ul class="nav nav-tabs">
<li class="active"><a href="#overview" data-toggle="tab">Locality</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="overview">
<form class="navbar-search pull-left">
<input type="text" class="search-query" placeholder="Search" data-provide="typeahead" id="search">
</form>
<iframe src="http://webtechdemo.de/PolygonTest/#" style="width: 100%; min-height: 800px; overflow:hidden; border: 0px; margin-top: 10px"></iframe>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,50 +0,0 @@
function init_saimod_dasense_quality_management(){
// auto-completion stuff
$('#search').typeahead({
source: function (query, process) {
return $.get('./api.php?call=analysis&action=data&get=locality&by=name', { query: query, limit: 8, options: {flag:0} }, function (data) {
//console.log(data);
var source = new Backbone.Collection(data.result).models;
// passing an array of objects
process( _.map(source, function (locality) {
return {
id: locality.get('localityid'),
full_name: locality.get('de_name') + ' (' + locality.get('en_name') + ')',
// these functions allows Bootstrap typehead to use this item in places where it was expecting a string
toString: function () {
return JSON.stringify(this);
},
toLowerCase: function () {
return this.full_name.toLowerCase();
},
indexOf: function () {
return String.prototype.indexOf.apply(this.full_name, arguments);
},
replace: function () {
return String.prototype.replace.apply(this.full_name, arguments);
}
};
}));
});
},
display: 'full_name',
updater: function(itemString){
var item = JSON.parse(itemString);
refreshMap(item.id);
return item.full_name;
}
});
}
function refreshMap(localityID){
$.get('./api.php?call=analysis&action=data&get=locality&by=id', { locality_id: localityID, include_geometry: 1, include_children: 1 }, function (data) {
console.log(data);
// @todo: refresh map -> current locality + children geometries
});
}
function destroy(){}

View File

@ -1,12 +0,0 @@
<?php
class saimod_dasense_quality_management extends \SYSTEM\SAI\SaiModule {
public static function sai_mod_saimod_dasense_quality_management(){
return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/main.html', array());}
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_dasense_quality_management">Quality Management</a></li><li class="divider"></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
public static function sai_mod_saimod_dasense_quality_management_flag_js(){return \SYSTEM\LOG\JsonResult::toString(
array( \SYSTEM\WEBPATH(new \PSAI(),'saimod_dasense_quality_management/qualitymanagement.js')
));}
public static function sai_mod_saimod_dasense_quality_management_flag_css(){}
}

View File

@ -0,0 +1,3 @@
td.customer_details {
font-weight: bold;
}

View File

@ -0,0 +1,3 @@
function init_saimod_webcraft_billing_satelite() {
$('#billingtab a').click(function (e) {e.preventDefault(); $(this).tab('show');});
}

View File

@ -0,0 +1,43 @@
<?php
class saimod_webcraft_billing_satelite extends \SYSTEM\SAI\SaiModule {
public static function sai_mod_saimod_webcraft_billing_satelite(){
$token = \SYSTEM\CONFIG\config::get(config_ids::WEBCRAFT_BILLING_TOKEN);
$billing = json_decode(file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=billing&token='.$token),true);
$project = json_decode(file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=project&token='.$token),true);
$customer = json_decode(file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=customer&token='.$token),true);
$vars = array('content_project' => '');
if($project['status']){
foreach($project['result'] as $row){
$row['customer_company'] = $row['customer_company'] == "" ? $row['customer_company'] = "" : $row['customer_company'] .= " - ";
$vars['content_project'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite_content_project.tpl'), $row);}
}
$vars['content_billing'] = '';
if($billing['status']){
foreach($billing['result'] as $row){
$row['pdf_link'] = './sai.php?sai_mod=saimod_webcraft_billing_satelite&action=getpdf&billid='.$row['ID'];
$row['state'] = $row['payed_date'] == "0000-00-00 00:00:00" ? "important" : "success";
$vars['content_billing'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite_content_billing.tpl'), $row);}
}
if($customer['status']){
$vars = array_merge($vars,$customer['result']);}
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite.tpl'), $vars);}
public static function sai_mod_saimod_webcraft_billing_satelite_action_getpdf($billid){
$token = \SYSTEM\CONFIG\config::get(config_ids::WEBCRAFT_BILLING_TOKEN);
header("Content-type: application/pdf");
return file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=bill&token='.$token.'&ID='.$billid);}
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_webcraft_billing_satelite">Rechnungen</a></li><li class="divider"></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
public static function sai_mod_saimod_webcraft_billing_satelite_flag_js(){
return \SYSTEM\LOG\JsonResult::toString(
array( \SYSTEM\WEBPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite.js')));}
public static function sai_mod_saimod_webcraft_billing_satelite_flag_css(){
return \SYSTEM\LOG\JsonResult::toString(
array( \SYSTEM\WEBPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite.css')));}
}

View File

@ -0,0 +1,66 @@
<h4>Verwaltung</h4>
<hr>
<div class="tabbable">
<ul class="nav nav-tabs" id="billingtab">
<li class="active"><a href="#tab_billing">Rechnungen</a></li>
<li><a href="#tab_project">Projekte</a></li>
<li><a href="#tab_customer">Kundeninformation</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_billing">
<table class="table table-hover table-condensed sai_table" style="overflow: auto;">
<tr>
<th>Rechnungsnummer</th>
<th>Projekt</th>
<th>Datum</th>
<th>PDF</th>
<th>Betrag</th>
<th>Bezahlt am</th>
</tr>
${content_billing}
</table>
</div>
<div class="tab-pane" id="tab_project">
<table class="table table-hover table-condensed sai_table" style="overflow: auto;">
<tr>
<th>ID</th>
<th>Nutzer</th>
<th>Firma</th>
<th>seit</th>
<th>URL</th>
<th>Serverpfad</th>
<th>token</th>
</tr>
${content_project}
</table>
</div>
<div class="tab-pane" id="tab_customer">
<table class="table table-hover table-condensed sai_table" style="overflow: auto;">
<tr>
<td class="customer_details">Nutzer ID</td>
<td>${ID}</td>
</tr>
<tr>
<td class="customer_details">Firma</td>
<td>${company}</td>
</tr>
<tr>
<td class="customer_details">Vorname</td>
<td>${name}</td>
</tr>
<tr>
<td class="customer_details">Nachname</td>
<td>${name_last}</td>
</tr>
<tr>
<td class="customer_details">Addresse</td>
<td>${address}</td>
</tr>
<tr>
<td class="customer_details">Beigetreten</td>
<td>${join}</td>
</tr>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,8 @@
<tr>
<td>${ID}</td>
<td>${project_name}</td>
<td>${date}</td>
<td><a href="${pdf_link}" target="_blank">PDF</a></td>
<td>${balance} €</td>
<td><span class="badge badge-${state}">${payed_date}</span></td>
</tr>

View File

@ -0,0 +1,9 @@
<tr>
<td>${ID}</td>
<td>${customer_company}${customer_name} ${customer_name_last}</td>
<td>${name}</td>
<td>${date}</td>
<td><a href="${url}" target="_blank">${url}</a></td>
<td>${path}</td>
<td>${token}</td>
</tr>