#3 docu sai
This commit is contained in:
parent
3d32b6756e
commit
54aaf1a1d2
@ -16,6 +16,4 @@ require_once dirname(__FILE__).'/saimod_sys_cron/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_sys_todo/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_sys_git/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_sys_docu/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_sys_login/autoload.inc';
|
||||
//Project Mod
|
||||
require_once dirname(__FILE__).'/saimod_sys_langswitcher/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_sys_login/autoload.inc';
|
||||
@ -31,6 +31,12 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_api/tpl/saimod_sys_api.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the List of API Entries
|
||||
*
|
||||
* @param int $group Group Filter of the List
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_api_action_list($group=null){
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_API_GET::QQ();
|
||||
$tab = array('content' => '');
|
||||
@ -46,14 +52,39 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_api/tpl/saimod_sys_api_list.tpl'))->SERVERPATH(), $tab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Delete Dialog of a API Entry
|
||||
*
|
||||
* @param int $ID ID of the Entry
|
||||
* @param int $group Group id of the Entry
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID,$group){
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_API_SINGLE_SELECT::Q1(array($ID,$group));
|
||||
$res = array_merge($res,\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_API));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_api/tpl/delete_dialog.tpl'))->SERVERPATH(), $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the New Dialog for a API Entry
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_api_action_newdialog(){
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_api/tpl/new_dialog.tpl'))->SERVERPATH(),\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_API));}
|
||||
|
||||
/**
|
||||
* Add a new API Entry
|
||||
*
|
||||
* @param int $ID ID of the Entry
|
||||
* @param int $group Group id of the Entry
|
||||
* @param int $type Type of the new Entry
|
||||
* @param int $parentID Parent id of the new Entry
|
||||
* @param string $parentValue Parent Valze of the new Entry
|
||||
* @param string $name Name of the new Entry
|
||||
* @param string $verify Verifiername of the new Entry
|
||||
* @return JSON Returns json with status true of error
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_api_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){
|
||||
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
|
||||
@ -63,6 +94,13 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a API Entry
|
||||
*
|
||||
* @param int $ID ID of the Entry
|
||||
* @param int $group Group id of the Entry
|
||||
* @return JSON Returns json with status true of error
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_api_action_deletecall($ID,$group){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){
|
||||
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
|
||||
@ -70,6 +108,12 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal Function to decode Types to Strings
|
||||
*
|
||||
* @param int $type Type of the Page Entry
|
||||
* @return string Returns string representing the type
|
||||
*/
|
||||
private static function type_names($type){
|
||||
switch($type){
|
||||
case 0: return 'COMMAND';
|
||||
@ -81,6 +125,12 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal Function to generate api row classes
|
||||
*
|
||||
* @param int $flag Flag of the API Entry
|
||||
* @return string Returns string representing the flag
|
||||
*/
|
||||
private static function tablerow_class($flag){
|
||||
switch($flag){
|
||||
case 0: return 'info';
|
||||
|
||||
@ -32,9 +32,20 @@ class saimod_sys_cache extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_cache/tpl/saimod_sys_cache.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the Cache
|
||||
*
|
||||
* @return json Returns json with status true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_cache_action_clear(){
|
||||
return \SYSTEM\SQL\SYS_SAIMOD_CACHE_CLEAR::QI() ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::fail();}
|
||||
|
||||
/**
|
||||
* internal function to map CacheID to a tr class(color)
|
||||
*
|
||||
* @param int $cacheID Id of the Cache
|
||||
* @return string Returns table row class
|
||||
*/
|
||||
private static function tablerow_class($cacheID){
|
||||
if($cacheID == 1){
|
||||
return 'info';}
|
||||
|
||||
@ -83,7 +83,12 @@ class saimod_sys_config extends \SYSTEM\SAI\SaiModule {
|
||||
'value' =>\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_PROJECT)));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_config/tpl/config.tpl'))->SERVERPATH(),$vars);
|
||||
}
|
||||
//public static function html_li_menu(){return '<li><a id="menu_config" href="#!config">${sai_menu_config}</a></li>';}
|
||||
|
||||
/**
|
||||
* Generate HTML for Menu Basics
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_config_action_basics(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_CONFIG);
|
||||
$vars['basics'] = $vars['database'] = $vars['sai'] = '';
|
||||
@ -118,6 +123,12 @@ class saimod_sys_config extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_config/tpl/config_basics.tpl'))->SERVERPATH(),$vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate HTML for Menu Database
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_config_action_database(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_CONFIG);
|
||||
$vars['database'] = '';
|
||||
@ -148,6 +159,12 @@ class saimod_sys_config extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_config/tpl/config_database.tpl'))->SERVERPATH(),$vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate HTML for Menu SAI
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_config_action_sai(){
|
||||
$vars['sai'] = '';
|
||||
$vars['sai'] .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_config/tpl/config_tr.tpl'))->SERVERPATH(),
|
||||
|
||||
@ -36,6 +36,13 @@ class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_cron/tpl/tabs.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Status of a Cron Entry
|
||||
*
|
||||
* @param string $cls Classname of the Cron
|
||||
* @param int $status New Status
|
||||
* @return JSON Returns json with status true of error
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_cron_action_change($cls,$status){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_CRON)){
|
||||
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
|
||||
@ -43,6 +50,17 @@ class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Cron Entry
|
||||
*
|
||||
* @param string $cls Classname of the Cron
|
||||
* @param int $min Minute Value
|
||||
* @param int $hour Hour Value
|
||||
* @param int $day Day Value
|
||||
* @param int $day_week Day of the Week Value
|
||||
* @param int $month Month Value
|
||||
* @return JSON Returns json with status true of error
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_cron_action_add($cls,$min,$hour,$day,$day_week,$month){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_CRON)){
|
||||
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
|
||||
@ -52,6 +70,12 @@ class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a Cron Entry
|
||||
*
|
||||
* @param string $cls Classname of the Cron
|
||||
* @return JSON Returns json with status true of error
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_cron_action_del($cls){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_CRON)){
|
||||
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
|
||||
|
||||
@ -29,6 +29,11 @@ class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_docu/tpl/saimod_sys_docu.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML Documentation
|
||||
*
|
||||
* @return null Returns null
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_docu_action_generate(){
|
||||
\LIB\lib_phpdocumentor::php();
|
||||
$configs = \SYSTEM\DOCU\docu::getAll();
|
||||
@ -42,6 +47,11 @@ class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
|
||||
$config['parseprivate']);}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the MD Documentation based on the HTML Documentation
|
||||
*
|
||||
* @return null Returns null
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_docu_action_generate_md(){
|
||||
\LIB\lib_phpdoc_md::php();
|
||||
$configs = \SYSTEM\DOCU\docu::getAll();
|
||||
@ -50,10 +60,15 @@ class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
|
||||
$config['outpath_md']);}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Iframe of the selected Category
|
||||
*
|
||||
* @param string $cat Category of the Documentation to be presented
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_docu_action_cat($cat = 'system'){
|
||||
$vars = array('iframesrc' => \SYSTEM\DOCU\docu::get($cat)['outpath']->WEBPATH(false));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_docu/tpl/saimod_sys_docu_iframe.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_docu/tpl/saimod_sys_docu_iframe.tpl'))->SERVERPATH(), $vars);}
|
||||
|
||||
/**
|
||||
* Generate <li> Menu for the Saimod
|
||||
|
||||
@ -14,7 +14,14 @@ namespace SYSTEM\SAI;
|
||||
/**
|
||||
* saimod_sys_files Class provided by System as saimod to manage files (files feature)
|
||||
*/
|
||||
class saimod_sys_files extends \SYSTEM\SAI\SaiModule {
|
||||
class saimod_sys_files extends \SYSTEM\SAI\SaiModule {
|
||||
/**
|
||||
* Delete a File in a Files Directory
|
||||
*
|
||||
* @param string $cat Name of the Files Directory
|
||||
* @param string $id Name of the File
|
||||
* @return json Returns json with status true or error
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_files_action_del($cat,$id){
|
||||
if(!\SYSTEM\FILES\files::delete($cat, $id)){
|
||||
throw new \SYSTEM\LOG\ERROR("delete problem");}
|
||||
@ -22,6 +29,14 @@ class saimod_sys_files extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a File in a Files Directory
|
||||
*
|
||||
* @param string $cat Name of the Files Directory
|
||||
* @param string $id Name of the File
|
||||
* @param string $newid New Name of the File
|
||||
* @return json Returns json with status true or error
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_files_action_rn($cat,$id,$newid){
|
||||
if(!\SYSTEM\FILES\files::rename($cat, $id, $newid)){
|
||||
throw new \SYSTEM\LOG\ERROR("rename problem");}
|
||||
@ -29,6 +44,12 @@ class saimod_sys_files extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploadcall to a Files Directory. Expects a File been uploaded.
|
||||
*
|
||||
* @param string $cat Name of the Files Directory
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_files_action_upload($cat){
|
||||
if(!\SYSTEM\FILES\files::put($cat, basename($_FILES['datei_'.$cat]['name']) , $_FILES['datei_'.$cat]['tmp_name'])){
|
||||
throw new \SYSTEM\LOG\ERROR("upload problem");}
|
||||
@ -51,6 +72,12 @@ class saimod_sys_files extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_files/tpl/saimod_sys_files.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the one Files Directory
|
||||
*
|
||||
* @param string $name Name of the Files Directory
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_files_action_tab($name = 'sys'){
|
||||
$result = '';
|
||||
$cat = \SYSTEM\FILES\files::get($name);
|
||||
|
||||
@ -23,9 +23,13 @@ class saimod_sys_git extends \SYSTEM\SAI\SaiModule {
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_git(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_GIT);
|
||||
$vars = array_merge($vars,self::getGitInfo());
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_git/tpl/saimod_sys_git.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_git/tpl/saimod_sys_git.tpl'))->SERVERPATH(), $vars);}
|
||||
|
||||
/**
|
||||
* Read Git Information
|
||||
*
|
||||
* @return array Returns Array with Git Information
|
||||
*/
|
||||
public static function getGitInfo(){
|
||||
\LIB\lib_git::php();
|
||||
$result = array('git_project' => '', 'git_system' => '');
|
||||
@ -49,13 +53,6 @@ class saimod_sys_git extends \SYSTEM\SAI\SaiModule {
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function tablerow_class($cacheID){
|
||||
if($cacheID == 1){
|
||||
return 'info';}
|
||||
|
||||
return 'success';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate <li> Menu for the Saimod
|
||||
*
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
|
||||
\SYSTEM\SAI\sai::register('\SYSTEM\SAI\saimod_sys_langswitcher');
|
||||
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* System - PHP Framework
|
||||
*
|
||||
* PHP Version 5.6
|
||||
*
|
||||
* @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link https://github.com/webcraftmedia/system
|
||||
* @package SYSTEM\SAI
|
||||
*/
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
/**
|
||||
* saimod_sys_langswitcher Class provided by System as saimod to display langswitching functionality
|
||||
* @todo Remove as saimod
|
||||
*/
|
||||
class saimod_sys_langswitcher extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_li_menu(){
|
||||
//return self::lang_menu('./sai.php');
|
||||
|
||||
}
|
||||
public static function right_public(){return true;}
|
||||
public static function right_right(){return true;}
|
||||
|
||||
public static function lang_menu($endpoint = './api.php'){
|
||||
$result = '';
|
||||
$langs = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS);
|
||||
foreach($langs as $lang){
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_langswitcher/tpl/language.tpl'))->SERVERPATH(),array('lang' => $lang,'endpoint' => $endpoint));}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//public static function css(){}
|
||||
//public static function js(){}
|
||||
}
|
||||
@ -14,11 +14,21 @@ namespace SYSTEM\SAI;
|
||||
/**
|
||||
* saimod_sys_log Class provided by System as saimod to manage the system_log table
|
||||
*/
|
||||
class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
/**
|
||||
* Deletes the Log Entries
|
||||
*
|
||||
* @return json Returns json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_truncate(){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_LOG_TRUNCATE::QQ();
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Generates HTML for one Log Analytics Entry
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function analytics(){
|
||||
$vars = array();
|
||||
$data = \SYSTEM\SQL\SYS_SAIMOD_LOG_ANALYTICS::Q1(array(86400));
|
||||
@ -39,6 +49,11 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_log/tpl/saimod_sys_log_analytics.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates HTML for the Log Analytics
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_LOG);
|
||||
$vars['dbfile_entries'] = '';
|
||||
@ -52,6 +67,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
//$vars['analytics'] = self::analytics();
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_log/tpl/saimod_sys_log_stats.tpl'))->SERVERPATH(), $vars);}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for class system
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_system($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -79,6 +101,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for class other
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_other($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -102,6 +131,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for class basic
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_basic($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -127,6 +163,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for unique basic
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_basic($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -150,6 +193,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for unique request
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_request($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -174,6 +224,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for unqiue exception
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_exception($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -197,6 +254,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for unique referer
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_referer($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -221,6 +285,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for basic visitor
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_visitor($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -243,6 +314,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for basic success
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_sucess($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -279,6 +357,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
}
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||
|
||||
/**
|
||||
* Get Log Analytics Data for basic querytime
|
||||
*
|
||||
* @param int $filter Timeiterval in seconds to cluster upon
|
||||
* @param string $db DB to operate on
|
||||
* @return json Returns json with data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_querytime($filter,$db){
|
||||
$result = array();
|
||||
if(!$db){
|
||||
@ -301,12 +386,26 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
}
|
||||
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||
|
||||
/**
|
||||
* Generates HTML for a Log Entry
|
||||
*
|
||||
* @param int $error ID of the Error
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_error($error){
|
||||
$vars = \SYSTEM\SQL\SYS_SAIMOD_LOG_ERROR::QQ(array($error))->next();
|
||||
$vars['trace'] = implode('</br>', array_slice(explode('#', $vars['trace']), 1, -1));
|
||||
$vars = array_merge($vars,\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_LOG));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_log/tpl/saimod_sys_log_error.tpl'))->SERVERPATH(), $vars);}
|
||||
|
||||
/**
|
||||
* Generates HTML for the Log List
|
||||
*
|
||||
* @param string $filter Classfilter
|
||||
* @param string $search SearchFilter
|
||||
* @param int $page Page of the List(100 are displayed)
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_filter($filter = "%",$search="%",$page=0){
|
||||
$filter = str_replace('\\', '\\\\', $filter);
|
||||
$count = \SYSTEM\SQL\SYS_SAIMOD_LOG_FILTER_COUNT::Q1(array($filter,$search,$search,$search))['count'];
|
||||
@ -354,6 +453,12 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_log/tpl/saimod_sys_log.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function to map log class to a tr class(color)
|
||||
*
|
||||
* @param string $class Name of a Class
|
||||
* @return string Returns table row class
|
||||
*/
|
||||
public static function tablerow_class($class){
|
||||
switch($class){
|
||||
case 'SYSTEM\LOG\INFO': case 'INFO': case 'SYSTEM\LOG\COUNTER':
|
||||
|
||||
@ -36,6 +36,11 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_login/tpl/login.tpl'))->SERVERPATH(), $vars);}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Users Info or NULL if not logged in
|
||||
*
|
||||
* @return json Returns json with userinfo or null
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_login_action_userinfo(){
|
||||
$user = \SYSTEM\SECURITY\security::getUser();
|
||||
if(!$user){
|
||||
@ -46,7 +51,12 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule {
|
||||
'locale' => $user->locale,
|
||||
'last_active' => $user->lastLoginDate));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Registerform
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_login_action_registerform(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_LOGIN);
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_login/tpl/register.tpl'))->SERVERPATH(), $vars);}
|
||||
|
||||
@ -15,6 +15,11 @@ namespace SYSTEM\SAI;
|
||||
* saimod_sys_mod Class provided by System as saimod to display all registered saimods & libraries
|
||||
*/
|
||||
class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
|
||||
/**
|
||||
* Generate the HTML for the System Page
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_mod_action_system(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_MOD);
|
||||
$vars['entries'] = '';
|
||||
@ -35,6 +40,11 @@ class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_mod/tpl/mod_table.tpl'))->SERVERPATH(),$vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Project Page
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_mod_action_project(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_MOD);
|
||||
$vars['entries'] = $vars['saistart'] = '';
|
||||
@ -49,6 +59,11 @@ class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_mod/tpl/mod_table.tpl'))->SERVERPATH(),$vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Lib Page
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_mod_action_lib(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_MOD);
|
||||
$vars['entries'] = '';
|
||||
|
||||
@ -30,6 +30,12 @@ class saimod_sys_page extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_page/tpl/saimod_sys_page.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the List of Page Entries
|
||||
*
|
||||
* @param int $group Group Filter of the List
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_page_action_list($group=null){
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_PAGE_GET::QQ();
|
||||
$tab = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_PAGE);
|
||||
@ -45,14 +51,39 @@ class saimod_sys_page extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_page/tpl/saimod_sys_page_list.tpl'))->SERVERPATH(), $tab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Delete Dialog of a Page Entry
|
||||
*
|
||||
* @param int $ID ID of the Entry
|
||||
* @param int $group Group id of the Entry
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_page_action_deletedialog($ID,$group){
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_PAGE_SINGLE_SELECT::Q1(array($ID,$group));
|
||||
$res = array_merge($res,\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_PAGE));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_page/tpl/delete_dialog.tpl'))->SERVERPATH(), $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the New Dialog for a Page Entry
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_page_action_newdialog(){
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_page/tpl/new_dialog.tpl'))->SERVERPATH(),\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_PAGE));}
|
||||
|
||||
/**
|
||||
* Add a new Page Entry
|
||||
*
|
||||
* @param int $ID ID of the Entry
|
||||
* @param int $group Group id of the Entry
|
||||
* @param int $type Type of the new Entry
|
||||
* @param int $parentID Parent id of the new Entry
|
||||
* @param string $parentValue Parent Valze of the new Entry
|
||||
* @param string $name Name of the new Entry
|
||||
* @param string $verify Verifiername of the new Entry
|
||||
* @return JSON Returns json with status true of error
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_page_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){
|
||||
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
|
||||
@ -62,6 +93,13 @@ class saimod_sys_page extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a Page Entry
|
||||
*
|
||||
* @param int $ID ID of the Entry
|
||||
* @param int $group Group id of the Entry
|
||||
* @return JSON Returns json with status true of error
|
||||
*/
|
||||
public static function sai_mod__system_sai_saimod_sys_page_action_deletecall($ID,$group){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){
|
||||
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
|
||||
@ -69,6 +107,12 @@ class saimod_sys_page extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal Function to decode Types to Strings
|
||||
*
|
||||
* @param int $type Type of the Page Entry
|
||||
* @return string Returns string representing the type
|
||||
*/
|
||||
private static function type_names($type){
|
||||
switch($type){
|
||||
case 0: return 'STATIC';
|
||||
@ -77,6 +121,12 @@ class saimod_sys_page extends \SYSTEM\SAI\SaiModule {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal Function to generate page row classes
|
||||
*
|
||||
* @param int $flag Flag of the Page Entry
|
||||
* @return string Returns string representing the flag
|
||||
*/
|
||||
private static function tablerow_class($flag){
|
||||
switch($flag){
|
||||
case 0: return 'success';
|
||||
|
||||
@ -15,13 +15,28 @@ namespace SYSTEM\SAI;
|
||||
* saimod_sys_security Class provided by System as saimod to manage the system_user, system_rights, system_user_to_rights table
|
||||
*/
|
||||
class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
/**
|
||||
* Generate HTML for the Security Groups(Menu)
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_groups(){
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_groups.tpl'))->SERVERPATH(),\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_SECURITY));}
|
||||
|
||||
/**
|
||||
* Generate HTML for the new right dialog
|
||||
*
|
||||
* @param int $id ID of the right
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_newright(){
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_newright.tpl'))->SERVERPATH(),\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_SECURITY));}
|
||||
|
||||
|
||||
/**
|
||||
* Generate HTML for the list of rights
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_rights(){
|
||||
$rows = '';
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_SECURITY_RIGHTS::QQ();
|
||||
@ -38,6 +53,13 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_rights.tpl'))->SERVERPATH(),$vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a Right of a User
|
||||
*
|
||||
* @param int $rightid ID of the Right
|
||||
* @param int $userid ID of the User
|
||||
* @return bool Returns true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_deleterightuser($rightid,$userid){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_SECURITY_RIGHTS_EDIT)){
|
||||
return false;}
|
||||
@ -46,6 +68,13 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
return false;}
|
||||
return \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER_RIGHT_DELETE::QI(array($rightid,$userid));}
|
||||
|
||||
/**
|
||||
* Add a Right to a User
|
||||
*
|
||||
* @param int $rightid ID of the Right
|
||||
* @param int $userid ID of the User
|
||||
* @return bool Returns true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_addrightuser($rightid,$userid){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_SECURITY_RIGHTS_EDIT)){
|
||||
return false;}
|
||||
@ -54,22 +83,48 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
return false;}
|
||||
return \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER_RIGHT_INSERT::QI(array($rightid,$userid));}
|
||||
|
||||
/**
|
||||
* Add a Right
|
||||
*
|
||||
* @param int $id ID of the Right
|
||||
* @param string $name Name of the Right
|
||||
* @param string $description Description of the Right
|
||||
* @return bool Returns true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_addright($id,$name,$description){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_SECURITY_RIGHTS_EDIT)){
|
||||
return false;}
|
||||
return \SYSTEM\SQL\SYS_SAIMOD_SECURITY_RIGHT_INSERT::QI(array($id,$name,$description));}
|
||||
|
||||
/**
|
||||
* Generate HTML for the delete right confirm dialog
|
||||
*
|
||||
* @param int $id ID of the right
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_deleterightconfirm($id){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_SECURITY_RIGHTS_EDIT)){
|
||||
return false;}
|
||||
$vars = \SYSTEM\SQL\SYS_SAIMOD_SECURITY_RIGHT_CHECK::Q1(array($id));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_deleteright.tpl'))->SERVERPATH(),$vars);}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a Right
|
||||
*
|
||||
* @param int $id ID of the Right
|
||||
* @return bool Returns true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_deleteright($id){
|
||||
if(!\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_SECURITY_RIGHTS_EDIT)){
|
||||
return false;}
|
||||
return \SYSTEM\SQL\SYS_SAIMOD_SECURITY_RIGHT_DELETE::QI(array($id));}
|
||||
|
||||
//Todo move to log
|
||||
/**
|
||||
* Internal Function to generate HTML for the actions of a User
|
||||
*
|
||||
* @param int $userid Id of the User
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
private static function user_actions($userid){
|
||||
$count = \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER_LOG_COUNT::Q1(array($userid));
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER_LOG::QQ(array($userid));
|
||||
@ -87,6 +142,12 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_user_actions.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal Function to generate HTML for the rights of a User
|
||||
*
|
||||
* @param int $userid Id of the User
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
private static function user_rights($userid){
|
||||
$vars['user_rights_table'] = '';
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER_RIGHTS::QQ(array($userid));
|
||||
@ -115,10 +176,20 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_SECURITY));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_user_rights.tpl'))->SERVERPATH(), $vars);}
|
||||
|
||||
/**
|
||||
* Generate HTML for the Analytics
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_stats(){
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_stats.tpl'))->SERVERPATH(),\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_SECURITY));
|
||||
}
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_stats.tpl'))->SERVERPATH(),\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_SECURITY));}
|
||||
|
||||
/**
|
||||
* Generate HTML for a User
|
||||
*
|
||||
* @param string $username Username
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_user($username){
|
||||
$vars = \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER::Q1(array($username));
|
||||
$vars['email_confirmed'] = $vars['email_confirmed'] == 1 ? 'Yes' : 'No';
|
||||
@ -129,6 +200,14 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_user_view.tpl'))->SERVERPATH(),$vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate HTML for the Users List
|
||||
*
|
||||
* @param string $filter Filter by right
|
||||
* @param string $search Filter by user
|
||||
* @param int $page Page of the List (displays only 100)
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_users($filter = "all",$search="%",$page=0){
|
||||
$count = $filter == "all" ? \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER_COUNT::Q1(array($search,$search))['count'] :
|
||||
\SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER_COUNT_FILTER::Q1(array($search,$search,$filter))['count'];
|
||||
@ -175,17 +254,40 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
$vars['PICPATH'] = (new \SYSTEM\PSAI('modules/saimod_sys_log/img/'))->WEBPATH(false);
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security.tpl'))->SERVERPATH(), $vars);}
|
||||
|
||||
/**
|
||||
* Rename an Account
|
||||
*
|
||||
* @param string $username Username of the Account
|
||||
* @param string $new_username New Username
|
||||
* @return json Returns json with status true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_renameaccount($username,$new_username){
|
||||
if(\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_SECURITY_RIGHTS_EDIT)){
|
||||
return \SYSTEM\LOG\JsonResult::fail();}
|
||||
if(!\SYSTEM\SECURITY\security::available($new_username)){
|
||||
throw new \SYSTEM\LOG\ERROR("Username not available");}
|
||||
return \SYSTEM\SQL\SYS_SAIMOD_SECURITY_RENAME_USER::QI(array($new_username,$username)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::fail();
|
||||
}
|
||||
return \SYSTEM\SQL\SYS_SAIMOD_SECURITY_RENAME_USER::QI(array($new_username,$username)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::fail();}
|
||||
|
||||
/**
|
||||
* Delete an Account
|
||||
*
|
||||
* @param int $id Id of the Account
|
||||
* @return json Returns json with status true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_deleteaccount($id){
|
||||
if(\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_SECURITY_RIGHTS_EDIT)){
|
||||
return \SYSTEM\LOG\JsonResult::fail();}
|
||||
\SYSTEM\SQL\SYS_SAIMOD_SECURITY_DELETE_USER_RIGHTS::QI(array($id));
|
||||
\SYSTEM\SQL\SYS_SAIMOD_SECURITY_DELETE_USER::QI(array($id));
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Internal Function to generate the Tablerow class(color) string according
|
||||
* to last time active
|
||||
*
|
||||
* @param int $last_active Unixtimestamp
|
||||
* @return string Returns table row class string
|
||||
*/
|
||||
private static function tablerow_class($last_active){
|
||||
$time = time() - $last_active;
|
||||
|
||||
|
||||
@ -35,6 +35,11 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_text/tpl/saimod_sys_text.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Texts with no Tag
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_notag(){
|
||||
$res = \SYSTEM\SQL\SYS_SAIMOD_TEXT_GETTEXTS_NOTAG::QQ();
|
||||
$entries = '';
|
||||
@ -46,6 +51,15 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_text/tpl/saimod_sys_text_list.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Texts with a Tag
|
||||
*
|
||||
* @param string $tag Tag Filter
|
||||
* @param string $filter Language Filter
|
||||
* @param string $search Search Filter
|
||||
* @param int $page Page (Displays 100)
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_tag($tag = 'all',$filter = "all",$search="%",$page=0){
|
||||
if($tag == 'all'){
|
||||
if($filter == 'all'){
|
||||
@ -102,6 +116,13 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_text/tpl/saimod_sys_text_list.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML to edit a text
|
||||
*
|
||||
* @param string $id Text ID
|
||||
* @param string $lang Language Filter
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_edittext($id,$lang){
|
||||
$langs = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS);
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_TEXT);
|
||||
@ -116,6 +137,13 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_text/tpl/saimod_sys_text_edit_langs.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the Editor
|
||||
*
|
||||
* @param string $id Text ID
|
||||
* @param string $lang Language Filter
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_editor($id, $lang){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_TEXT);
|
||||
$vars['id'] = $id;
|
||||
@ -129,9 +157,26 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_text/tpl/saimod_sys_text_edit_editor.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a Text into the Database
|
||||
*
|
||||
* @param string $id Text ID
|
||||
* @param string $new_id New Text ID
|
||||
* @param string $lang Language of the Text
|
||||
* @param json $tags Json with tags
|
||||
* @param string $text New text
|
||||
* @return json Retuns json with status true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_save($id, $new_id, $lang, $tags, $text){
|
||||
return \SYSTEM\PAGE\text::save($id, $new_id, $lang, \json_decode($tags), urldecode($text)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::fail();}
|
||||
|
||||
/**
|
||||
* Delete a Text from the Database
|
||||
*
|
||||
* @param string $id Text ID
|
||||
* @param string $lang Language of the Text
|
||||
* @return json Retuns json with status true or false
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_delete($id, $lang = null){
|
||||
return \SYSTEM\PAGE\text::delete($id, $lang) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::fail();}
|
||||
|
||||
|
||||
@ -15,38 +15,99 @@ namespace SYSTEM\SAI;
|
||||
* saimod_sys_todo Class provided by System as saimod to manage the system_todo, system_todo_assign table
|
||||
*/
|
||||
class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
/** array Variable to store all registred todo_stats*/
|
||||
private static $stats = array(); //only strings!
|
||||
|
||||
/**
|
||||
* Check if a todo_stats is valid
|
||||
*
|
||||
* @param string $stats Classname of the todo_stats
|
||||
* @return bool Returns true or false.
|
||||
*/
|
||||
private static function check_stats($stats){
|
||||
if( !\class_exists($stats) ||
|
||||
!\is_array($parents = \class_parents($stats)) ||
|
||||
!\array_search('SYSTEM\SAI\todo_stats', $parents)){
|
||||
!((new $stats) instanceof \SYSTEM\SAI\todo_stats)){
|
||||
return false;}
|
||||
return true;}
|
||||
|
||||
/**
|
||||
* Register a todo_stats
|
||||
*
|
||||
* @param string $stats Classname of the todo_stats
|
||||
* @return null Returns null.
|
||||
*/
|
||||
public static function register($stats){
|
||||
if(!self::check_stats($stats)){
|
||||
throw new \SYSTEM\LOG\ERROR('Problem with your TodoStats class: '.$stats);}
|
||||
array_push(self::$stats,$stats);}
|
||||
|
||||
/**
|
||||
* Assign a Todo to the User
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_assign($todo){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_ASSIGN::QI(array($todo,\SYSTEM\SECURITY\security::getUser()->id));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Deassign a Todo from the User
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_deassign($todo){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_DEASSIGN::QI(array($todo,\SYSTEM\SECURITY\security::getUser()->id));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
|
||||
/**
|
||||
* Close a Todo
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_close($todo){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_CLOSE::QI(array($todo));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Open a Todo
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_open($todo){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_OPEN::QI(array($todo));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Add a new Todo
|
||||
*
|
||||
* @param string $todo text of the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_add($todo){
|
||||
self::exception(new \Exception($todo), false, \SYSTEM\SQL\system_todo::FIELD_TYPE_USER);
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Increase the Priority of a Todo
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_priority_up($todo){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_PRIORITY::QI(array(+1,$todo));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Decrease the Priority of a Todo
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_priority_down($todo){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_PRIORITY::QI(array(-1,$todo));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
@ -62,17 +123,47 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the form to add a new Todo
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_new(){
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_TODO);
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_todo/tpl/saimod_sys_todo_new.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the list of open Todos
|
||||
*
|
||||
* @param string $filter Category Filter
|
||||
* @param string $search Search Parameter
|
||||
* @param int $page Page Number (returns only 100)
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_todolist($filter='all',$search='%',$page=0){
|
||||
return self::generate_list(\SYSTEM\SQL\system_todo::FIELD_STATE_OPEN,$filter,$search,$page);}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the list of closed Todos
|
||||
*
|
||||
* @param string $filter Category Filter
|
||||
* @param string $search Search Parameter
|
||||
* @param int $page Page Number (returns only 100)
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_dotolist($filter='all',$search='%',$page=0){
|
||||
return self::generate_list(\SYSTEM\SQL\system_todo::FIELD_STATE_CLOSED,$filter,$search,$page);}
|
||||
|
||||
/**
|
||||
* Internal Function to generate the HTML for the todo list
|
||||
*
|
||||
* @param int $state Todo State
|
||||
* @param string $filter Category Filter
|
||||
* @param string $search Search Parameter
|
||||
* @param int $page Page Number (returns only 100)
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
private static function generate_list($state,$filter,$search,$page){
|
||||
$vars = array();
|
||||
$vars['filter'] = $filter;
|
||||
@ -146,6 +237,11 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_todo/tpl/todo_list.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an array with values from all registered Todo Stats and Summary
|
||||
*
|
||||
* @return array Returns array with todo stats
|
||||
*/
|
||||
public static function statistics(){
|
||||
$result = array();
|
||||
$result['project'] = 0;
|
||||
@ -165,6 +261,11 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the HTML for the statistics of the ToDos
|
||||
*
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_stats(){
|
||||
$vars = self::statistics();
|
||||
$vars = array_merge($vars,\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_TODO));
|
||||
@ -181,16 +282,37 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_todo/tpl/todo_stats.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal Function to generate the text for Todo Status Open & Closed
|
||||
*
|
||||
* @param int $state State of the Todo
|
||||
* @return string Returns open or closed string
|
||||
*/
|
||||
private static function state($state){
|
||||
if($state == 1){
|
||||
return 'Closed';}
|
||||
return 'Open';}
|
||||
|
||||
/**
|
||||
* Internal Function to generate the Buttons for Todo Status Open & Closed
|
||||
*
|
||||
* @param int $state State of the Todo
|
||||
* @return string Returns the HTML of the open clase buttons
|
||||
*/
|
||||
private static function statebtn($state){
|
||||
if($state == 1){
|
||||
return '<input type="submit" class="btn-danger" value="reopen">';}
|
||||
return '<input type="submit" class="btn-danger" value="close">';}
|
||||
|
||||
/**
|
||||
* Internal Function to generate the Trclass(color) for the Todo
|
||||
*
|
||||
* @param int $type Type of the Todo
|
||||
* @param string $class Class of the Todo
|
||||
* @param int $assignee Userid of the assigned for this Todo
|
||||
* @param int $userid Userid of the Current logged in User
|
||||
* @return string Returns the HTML of the open clase buttons
|
||||
*/
|
||||
private static function trclass($type,$class,$assignee,$userid){
|
||||
if($type == \SYSTEM\SQL\system_todo::FIELD_TYPE_USER){
|
||||
if($assignee == $userid){ return 'success';}
|
||||
@ -212,22 +334,50 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close all Generated ToDos
|
||||
*
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_close_all(){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_CLOSE_ALL::QI();
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Edit the message of a Todo
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @param string $message Message for the Todo
|
||||
* @return JSON Returns Json with status ok
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_edit($todo, $message){
|
||||
\SYSTEM\SQL\SYS_SAIMOD_TODO_EDIT::QI(array($message,$message,$todo));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Calculate the Stats of closed ToDos
|
||||
*
|
||||
* @param string $filter Filter for the Calculation
|
||||
* @return JSON Returns Json with stats data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_stats_name_closed($filter){
|
||||
return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_CLOSED::QA(array($filter)));
|
||||
}
|
||||
return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_CLOSED::QA(array($filter)));}
|
||||
|
||||
/**
|
||||
* Calculate the Stats of assigned ToDos
|
||||
*
|
||||
* @param string $filter Filter for the Calculation
|
||||
* @return JSON Returns Json with stats data
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_stats_name_assigned($filter){
|
||||
return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_ASSIGNED::QA(array($filter)));
|
||||
}
|
||||
return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_ASSIGNED::QA(array($filter)));}
|
||||
|
||||
/**
|
||||
* Returns the HTML for a ToDo
|
||||
*
|
||||
* @param int $todo Id of the Todo
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_todo($todo){
|
||||
$userid = \SYSTEM\SECURITY\security::getUser()->id;
|
||||
$vars = \SYSTEM\SQL\SYS_SAIMOD_TODO_TODO::Q1(array($todo,$userid));
|
||||
@ -273,11 +423,27 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
public static function js(){
|
||||
return array(new \SYSTEM\PSAI('modules/saimod_sys_todo/js/saimod_sys_todo.js'));}
|
||||
|
||||
/**
|
||||
* Save a Report to the ToDo Database
|
||||
*
|
||||
* @param string $message Message of the Report
|
||||
* @param array/JSON $data Data for the Report
|
||||
* @return JSON Returns json with status true
|
||||
*/
|
||||
public static function report($message,$data){
|
||||
$_POST = $data; //save data in post
|
||||
self::exception(new \Exception($message), false, \SYSTEM\SQL\system_todo::FIELD_TYPE_REPORT);
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
/**
|
||||
* Save a Exception as ToDo in the Database
|
||||
* This is used as Errorhandler in some form.
|
||||
*
|
||||
* @param \Exception $E Exception to be saved
|
||||
* @param bool $thrown Was the Exception thrown?
|
||||
* @param int $type Type of the Todo(Exception)
|
||||
* @return bool Returns false
|
||||
*/
|
||||
public static function exception(\Exception $E, $thrown, $type = \SYSTEM\SQL\system_todo::FIELD_TYPE_EXCEPTION){
|
||||
try{
|
||||
if(\property_exists(get_class($E), 'todo_logged') && $E->todo_logged){
|
||||
|
||||
@ -1,7 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* System - PHP Framework
|
||||
*
|
||||
* PHP Version 5.6
|
||||
*
|
||||
* @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link https://github.com/webcraftmedia/system
|
||||
* @package SYSTEM\SAI
|
||||
*/
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class todo_stats_assign extends todo_stats {
|
||||
/**
|
||||
* todo_stats_assign Class provided by System to calculate assigned ToDo stats.
|
||||
*/
|
||||
class todo_stats_assign implements todo_stats {
|
||||
/**
|
||||
* Calculate the Assigned Todos Stats.
|
||||
*
|
||||
* @return \SYSTEM\SAI\todo_stats_data Returns todo_stats_data object
|
||||
*/
|
||||
public static function stats() {
|
||||
$count = \SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_COUNT_TODO_NOT_ASSIGNED::Q1()['count'];
|
||||
$all = \SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_COUNT_TODO_USER::Q1()['count'];
|
||||
|
||||
@ -1,7 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* System - PHP Framework
|
||||
*
|
||||
* PHP Version 5.6
|
||||
*
|
||||
* @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link https://github.com/webcraftmedia/system
|
||||
* @package SYSTEM\SAI
|
||||
*/
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class todo_stats_gen extends todo_stats {
|
||||
/**
|
||||
* todo_stats_gen Class provided by System to calculate generated ToDo stats.
|
||||
*/
|
||||
class todo_stats_gen implements todo_stats {
|
||||
/**
|
||||
* Calculate the Generated Todos Stats for the closed and open todos.
|
||||
*
|
||||
* @return \SYSTEM\SAI\todo_stats_data Returns todo_stats_data object
|
||||
*/
|
||||
public static function stats() {
|
||||
$res = array();
|
||||
$res[0] = \SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_COUNT_TODO_GEN::Q1();
|
||||
@ -9,4 +27,4 @@ class todo_stats_gen extends todo_stats {
|
||||
$count = floatval($res[2]['count']);
|
||||
$all = floatval($res[0]['count']+$res[2]['count']);
|
||||
return $all == 0 ? new \SYSTEM\SAI\todo_stats_data('Generated ToDos',1,1) : new \SYSTEM\SAI\todo_stats_data('Generated ToDos',$count,$all);}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* System - PHP Framework
|
||||
*
|
||||
* PHP Version 5.6
|
||||
*
|
||||
* @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link https://github.com/webcraftmedia/system
|
||||
* @package SYSTEM\SAI
|
||||
*/
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class todo_stats_report extends todo_stats {
|
||||
/**
|
||||
* todo_stats_report Class provided by System to calculate ToDo report stats.
|
||||
*/
|
||||
class todo_stats_report implements todo_stats {
|
||||
/**
|
||||
* Calculate the Stats for the report todos.
|
||||
*
|
||||
* @return \SYSTEM\SAI\todo_stats_data Returns todo_stats_data object
|
||||
*/
|
||||
public static function stats() {
|
||||
$res = array();
|
||||
$res[0] = \SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_COUNT_TODO_REPORT::Q1();
|
||||
|
||||
@ -1,7 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* System - PHP Framework
|
||||
*
|
||||
* PHP Version 5.6
|
||||
*
|
||||
* @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link https://github.com/webcraftmedia/system
|
||||
* @package SYSTEM\SAI
|
||||
*/
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class todo_stats_user extends todo_stats {
|
||||
/**
|
||||
* todo_stats_user Class provided by System to calculate ToDo user stats.
|
||||
*/
|
||||
class todo_stats_user implements todo_stats {
|
||||
/**
|
||||
* Calculate the User Stats for the closed and open todos.
|
||||
*
|
||||
* @return \SYSTEM\SAI\todo_stats_data Returns todo_stats_data object
|
||||
*/
|
||||
public static function stats() {
|
||||
$res = array();
|
||||
$res[0] = \SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_COUNT_TODO_USER::Q1();
|
||||
@ -9,4 +27,4 @@ class todo_stats_user extends todo_stats {
|
||||
$count = floatval($res[2]['count']);
|
||||
$all = floatval($res[0]['count']+$res[2]['count']);
|
||||
return $all == 0 ? new \SYSTEM\SAI\todo_stats_data('User ToDos',1,1) : new \SYSTEM\SAI\todo_stats_data('User ToDos',$count,$all);}
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,14 @@
|
||||
*/
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class todo_stats {
|
||||
public static function stats() {
|
||||
return new \SYSTEM\SAI\todo_stats_data();}
|
||||
}
|
||||
/**
|
||||
* todo_statsn Interface provided by System to calculate ToDo stats.
|
||||
*/
|
||||
interface todo_stats {
|
||||
/**
|
||||
* Calculate Function
|
||||
*
|
||||
* @return \SYSTEM\SAI\todo_stats_data Returns todo_stats_data object
|
||||
*/
|
||||
public static function stats();
|
||||
}
|
||||
@ -10,12 +10,29 @@
|
||||
* @package SYSTEM\SAI
|
||||
*/
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
/**
|
||||
* todo_stats_data Class provided by System as a container for todo stats
|
||||
*/
|
||||
class todo_stats_data {
|
||||
/** string Variable to store the Name of the ToDo Stats */
|
||||
var $name = '';
|
||||
/** string Variable to store the Open Todos Value of the ToDo Stats */
|
||||
var $open = 0;
|
||||
/** string Variable to store the Closed Todos Value of the ToDo Stats */
|
||||
var $closed = 0;
|
||||
/** string Variable to store all Todos Value of the ToDo Stats */
|
||||
var $all = 1;
|
||||
/** string Variable to store the Percatnage of Open to Closed of the ToDo Stats */
|
||||
var $perc = 0;
|
||||
|
||||
/**
|
||||
* Create the Datastorage with Data
|
||||
*
|
||||
* @param string $name Name of the ToDo Stats
|
||||
* @param int $closed Closed Todos Value of the ToDo Stats
|
||||
* @param int $all All Todos Value of the ToDo Stats
|
||||
*/
|
||||
public function __construct($name='',$closed=0,$all=1) {
|
||||
$this->name = $name;
|
||||
$this->open = $all-$closed;
|
||||
@ -23,4 +40,4 @@ class todo_stats_data {
|
||||
$this->all = $all;
|
||||
$this->perc = $this->all == 0 ? sprintf("%.2f",100) : sprintf("%.2f", $this->closed / $this->all * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -21,9 +21,34 @@ class saistart_sys_sai extends \SYSTEM\SAI\SaiModule {
|
||||
* @return string Returns HTML for the Saimods startpage
|
||||
*/
|
||||
public static function sai_mod__SYSTEM_SAI_saistart_sys_sai(){
|
||||
$vars = array_merge(array( 'content' => self::html_content()),
|
||||
\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_START));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saistart_sys_sai/tpl/saistart.tpl'))->SERVERPATH(),$vars);}
|
||||
if(!\SYSTEM\SECURITY\security::isLoggedIn() || !\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI)){
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saistart_sys_sai/tpl/content.tpl'))->SERVERPATH(),\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_START));}
|
||||
//create timestamp
|
||||
$week_number = date("W", time());
|
||||
$date = date("l M Y", time());
|
||||
|
||||
$vars = array();
|
||||
$vars['week_number'] = $week_number;
|
||||
$vars['date'] = $date;
|
||||
$vars['project_name'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_PROJECT);
|
||||
$vars['project_url'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL);
|
||||
$vars['analytics'] = \SYSTEM\SAI\saimod_sys_log::analytics();
|
||||
$user = \SYSTEM\SECURITY\security::getUser();
|
||||
$vars['username'] = $user->username;
|
||||
$vars['locale'] = $user->locale;
|
||||
$vars['isadmin'] = \SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) ? "yes" : "no";
|
||||
$vars['userstats'] = '';
|
||||
$userstats = \SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_USERS::QQ();
|
||||
while($stat = $userstats->next()){
|
||||
$stat['perc'] = round($stat['state_closed'] / ($stat['state_open']+$stat['state_closed']),2)*100;
|
||||
$vars['userstats'] .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_todo/tpl/todo_stats_users_entry.tpl'))->SERVERPATH(), $stat);
|
||||
}
|
||||
$vars = array_merge( $vars,
|
||||
\SYSTEM\SAI\saimod_sys_todo::statistics(),
|
||||
\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_START),
|
||||
\SYSTEM\SAI\saimod_sys_git::getGitInfo());
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saistart_sys_sai/tpl/content_loggedin.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate <li> Menu for the Saimod
|
||||
@ -65,34 +90,4 @@ class saistart_sys_sai extends \SYSTEM\SAI\SaiModule {
|
||||
new \SYSTEM\PSAI('js/crypto/jquery.sha1.js'),
|
||||
\LIB\lib_jqbootstrapvalidation::js());
|
||||
}
|
||||
|
||||
protected static function html_content(){
|
||||
//create timestamp
|
||||
$week_number = date("W", time());
|
||||
$date = date("l M Y", time());
|
||||
|
||||
if(!\SYSTEM\SECURITY\security::isLoggedIn() || !\SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI)){
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saistart_sys_sai/tpl/content.tpl'))->SERVERPATH());}
|
||||
$vars = array();
|
||||
$vars['week_number'] = $week_number;
|
||||
$vars['date'] = $date;
|
||||
$vars['project_name'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_PROJECT);
|
||||
$vars['project_url'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL);
|
||||
$vars['analytics'] = \SYSTEM\SAI\saimod_sys_log::analytics();
|
||||
$user = \SYSTEM\SECURITY\security::getUser();
|
||||
$vars['username'] = $user->username;
|
||||
$vars['locale'] = $user->locale;
|
||||
$vars['isadmin'] = \SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) ? "yes" : "no";
|
||||
$vars['userstats'] = '';
|
||||
$userstats = \SYSTEM\SQL\SYS_SAIMOD_TODO_STATS_USERS::QQ();
|
||||
while($stat = $userstats->next()){
|
||||
$stat['perc'] = round($stat['state_closed'] / ($stat['state_open']+$stat['state_closed']),2)*100;
|
||||
$vars['userstats'] .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_todo/tpl/todo_stats_users_entry.tpl'))->SERVERPATH(), $stat);
|
||||
}
|
||||
$vars = array_merge( $vars,
|
||||
\SYSTEM\SAI\saimod_sys_todo::statistics(),
|
||||
\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_START),
|
||||
\SYSTEM\SAI\saimod_sys_git::getGitInfo());
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saistart_sys_sai/tpl/content_loggedin.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
${content}
|
||||
@ -103,7 +103,7 @@ class default_page implements \SYSTEM\PAGE\DefaultPage {
|
||||
$vars['js'] = '';
|
||||
if(!$_escaped_fragment_){
|
||||
$vars['js'] = self::js();}
|
||||
$vars['menu_languages'] = \SYSTEM\SAI\saimod_sys_langswitcher::lang_menu('./sai.php');
|
||||
$vars['menu_languages'] = self::lang_menu('./sai.php');
|
||||
$vars['menu_start'] = self::menu_start();
|
||||
$vars['menu_sys'] = self::menu_sys();
|
||||
$vars['menu_proj'] = self::menu_proj();
|
||||
@ -112,4 +112,18 @@ class default_page implements \SYSTEM\PAGE\DefaultPage {
|
||||
'project_url' => \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL)));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('page/tpl/sai.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* generate the HTML for the Language Menu
|
||||
*
|
||||
* @param string $endpoint Endpoint for the Language Menu
|
||||
* @return string Returns HTML
|
||||
*/
|
||||
public static function lang_menu($endpoint = './api.php'){
|
||||
$result = '';
|
||||
$langs = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS);
|
||||
foreach($langs as $lang){
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('page/tpl/language.tpl'))->SERVERPATH(),array('lang' => $lang,'endpoint' => $endpoint));}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user