Exemple #1
0
 public static function init()
 {
     include_once Config::getConfig('CORE_ROOT') . "default_options.php";
     foreach ($arDefaultOptions as $option => $value) {
         static::$arOptions[$option] = $value;
     }
 }
Exemple #2
0
 function __construct()
 {
     $this->host = Config::getConfig('DB_HOST');
     $this->base = Config::getConfig('DB_NAME');
     $this->user = Config::getConfig('DB_USER');
     $this->pass = Config::getConfig('DB_PASS');
     $this->db_conn = mysql_connect($this->host, $this->user, $this->pass);
     mysql_select_db($this->base, $this->db_conn);
 }
Exemple #3
0
 public static function createPackageTables($strPackageName)
 {
     $strPackageName = strtolower($strPackageName);
     Loader::IncludePackage($strPackageName);
     $strBigPackageName = strtoupper($strPackageName);
     $strFirstBigPackageName = Tools::setFirstCharToBig($strPackageName);
     $strPackageRoot = Config::getConfig($strBigPackageName . "_ROOT");
     //msDebug($strPackageRoot);
     $strPackageTablesNamespace = "MSergeev\\Packages\\" . $strFirstBigPackageName . "\\Tables\\";
     $dir = $strPackageRoot . "tables/";
     $arTables = array();
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != "." && $file != ".." && $file != ".readme") {
                     $arTables[] = str_replace(".php", "", $file);
                 }
             }
             closedir($dh);
         }
     }
     foreach ($arTables as $fileTable) {
         if ($arClass = explode("_", $fileTable)) {
             $className = "";
             foreach ($arClass as $strName) {
                 $className .= Tools::setFirstCharToBig($strName);
             }
         } else {
             $className = Tools::setFirstCharToBig($arClass);
         }
         $className .= "Table";
         //call_user_func(array($strPackageTablesNamespace.$className,"installTable()"));
         $runClass = $strPackageTablesNamespace . $className;
         $runClass::createTable();
         $runClass::insertDefaultRows();
         //forward_static_call(array($strPackageTablesNamespace.$className,"installTable()"));
         //msDebug($strPackageTablesNamespace.$className."::installTable()");
     }
 }
<?php

/**
 * MSergeev
 * @package core
 * @author Mikhail Sergeev
 * @copyright 2016 Mikhail Sergeev
 */
$arConfig = array('DB_HOST' => 'localhost', 'DB_NAME' => 'db_terminal', 'DB_USER' => 'root', 'DB_PASS' => '', 'DOCUMENT_ROOT' => $_SERVER["DOCUMENT_ROOT"] . "/", 'SITE_ROOT' => $_SERVER["DOCUMENT_ROOT"], 'MSERGEEV_ROOT' => $_SERVER["DOCUMENT_ROOT"] . '/msergeev/', 'CORE_ROOT' => $_SERVER["DOCUMENT_ROOT"] . '/msergeev/core/', 'PACKAGES_ROOT' => $_SERVER["DOCUMENT_ROOT"] . '/msergeev/packages/', 'LANG' => 'ru');
include_once $arConfig["CORE_ROOT"] . 'lib/config.php';
\MSergeev\Core\Lib\Config::init($arConfig);
include_once \MSergeev\Core\Lib\Config::getConfig("MSERGEEV_ROOT") . 'include.php';
Exemple #5
0
 public static function init()
 {
     if (is_null(static::$coreRoot)) {
         static::$coreRoot = Config::getConfig('CORE_ROOT');
     }
     if (is_null(static::$mainJs)) {
         static::$mainJs = static::$coreRoot . 'plugins/webix/codebase/webix.js';
     }
     if (is_null(static::$mainCss)) {
         static::$mainCss = static::$coreRoot . 'plugins/webix/codebase/webix.css';
     }
     if (is_null(static::$otherCssCatalog)) {
         static::$otherCssCatalog = static::$coreRoot . 'plugins/webix/codebase/css/';
     }
     //if
     Buffer::addJS(static::$mainJs);
     Buffer::addCSS(static::$mainCss);
 }
Exemple #6
0
 /**
  * Возвращает HEX-код цвета по-умолчанию
  *
  * @return bool|string
  */
 public static function getDefaultColor()
 {
     return CoreLib\Config::getConfig('CALENDAR_DEFAULT_COLOR');
 }
Exemple #7
0
//MSergeev\Core\Lib\Loader::IncludePackage("apihelp");
//MSergeev\Core\Lib\Loader::IncludePackage("products");
//MSergeev\Core\Lib\Loader::IncludePackage("tasks");
//MSergeev\Core\Lib\Loader::IncludePackage("finances");
//MSergeev\Core\Lib\Loader::IncludePackage("calendar");
//MSergeev\Core\Lib\Loader::IncludePackage("owm");
//MSergeev\Core\Lib\Loader::IncludePackage("counters");
use MSergeev\Packages\Dates\Tables;
use MSergeev\Packages\ICar\Tables\CarGearboxTable;
use MSergeev\Core\Lib\Tools;
use MSergeev\Core\Lib\Installer;
use MSergeev\Core\Lib\Buffer;
use MSergeev\Core\Lib\Config;
use MSergeev\Packages\Tasks\Lib as TaskLib;
Buffer::start("page");
Buffer::addJS(Config::getConfig("CORE_ROOT") . "js/jquery-1.11.3.js");
?>
<!DOCTYPE html>
<html>
<head>
	<title><?php 
echo Buffer::showTitle("Главная");
?>
</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<?php 
echo Buffer::showCSS();
?>
	<?php 
echo Buffer::showJS();
?>
Exemple #8
0
			nday = now.getUTCDate();
			ndayofweek = now.getUTCDay();
			nmonth = now.getUTCMonth()+1;
			nyear = now.getUTCFullYear();
			nhour = now.getUTCHours()+ntimezone;
			nmin = now.getUTCMinutes();
			/*
			console.log(eday + "." + emonth + "." + eyear + " " + ehour + ":" + emin
			+ "(Пн-" + emonday + ", Вт-" + etuesday + ", Ср-" + ewednesday + ", Чт-" + ethursday + ", Пт-" + efriday
			+ ", Сб-" + esaturday + ", Вс-" + esunday + ", Буд-" + eworkday + ", Вых-" + eweekend + ")");
			console.log(nday + "." + nmonth + "." + nyear + " " + nhour + ":" + nmin + " " + ntimezone + "(" + ndayofweek + ")");
			*/

			$.post(
				"<?php 
echo \MSergeev\Core\Lib\Config::getConfig("EVENTS_TOOLS_ROOT") . 'get_nearest_date.php';
?>
",
				{
					eday: eday,
					emonth: emonth,
					eyear: eyear,
					ehour: ehour,
					emin: emin,
					eplusminus: eplusminus,
					eaddday: eaddday,
					enoday: enoday,
					emonday: emonday,
					etuesday: etuesday,
					ewednesday: ewednesday,
					ethursday: ethursday,
Exemple #9
0
			nday = now.getUTCDate();
			ndayofweek = now.getUTCDay();
			nmonth = now.getUTCMonth() + 1;
			nyear = now.getUTCFullYear();
			nhour = now.getUTCHours() + ntimezone;
			nmin = now.getUTCMinutes();
			/*
			 console.log(eday + "." + emonth + "." + eyear + " " + ehour + ":" + emin
			 + "(Пн-" + emonday + ", Вт-" + etuesday + ", Ср-" + ewednesday + ", Чт-" + ethursday + ", Пт-" + efriday
			 + ", Сб-" + esaturday + ", Вс-" + esunday + ", Буд-" + eworkday + ", Вых-" + eweekend + ")");
			 console.log(nday + "." + nmonth + "." + nyear + " " + nhour + ":" + nmin + " " + ntimezone + "(" + ndayofweek + ")");
			 */

			$.post(
				"<?php 
    echo \MSergeev\Core\Lib\Config::getConfig("CALENDAR_TOOLS_ROOT") . 'get_nearest_date.php';
    ?>
",
				{
					eday: eday,
					emonth: emonth,
					eyear: eyear,
					ehour: ehour,
					emin: emin,
					eplusminus: eplusminus,
					eaddday: eaddday,
					enoday: enoday,
					emonday: emonday,
					etuesday: etuesday,
					ewednesday: ewednesday,
					ethursday: ethursday,
Exemple #10
0
 public static function getMap()
 {
     return array(new Entity\IntegerField('ID', array('primary' => true, 'autocomplete' => true, 'title' => 'ID записи о пользователе')), new Entity\IntegerField('USER_ID', array('required' => true, 'default_value' => 0, 'title' => 'ID пользователя в системе')), new Entity\StringField('NAME', array('required' => true, 'title' => 'Имя пользователя')), new Entity\StringField('COLOR', array('required' => true, 'size' => 7, 'default_value' => Lib\Config::getConfig('CALENDAR_DEFAULT_COLOR'), 'title' => 'HEX-код цвета пользователя')));
 }
Exemple #11
0
function LineCharts($arParams = null)
{
    /*
    $arParams = array();
    $arParams['title'] = 'Средняя месячная температура';
    $arParams['subtitle'] = 'Источник: WorldClimate.com';
    $arParams['xAxis'] = array('Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек');
    $arParams['yAxis'] = 'Температура (°C)';
    $arParams['valueSuffix'] = '°C';
    $arParams['series'] = array(
    	0 => array(
    		'name' => 'Токио',
    		'data' => array(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6)
    	),
    	1 => array(
    		'name' => 'Нью-Йорк',
    		'data' => array(-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5)
    	),
    	2 => array(
    		'name' => 'Берлин',
    		'data' => array(-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0)
    	),
    	3 => array(
    		'name' => 'Лондон',
    		'data' => array(3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8)
    	)
    );
    */
    try {
        if (is_null($arParams)) {
            throw new Exception\ArgumentNullException('arParams');
        } else {
            if (!isset($arParams['title'])) {
                $arParams['title'] = 'График';
            }
            if (!isset($arParams['subtitle'])) {
                $arParams['subtitle'] = 'MajorDoMo';
            }
            if (!isset($arParams['xAxis'])) {
                throw new Exception\ArgumentNullException('arParams[xAxis]');
            } elseif (!is_array($arParams['xAxis'])) {
                throw new Exception\ArgumentOutOfRangeException('arParams[xAxis]');
            }
            if (!isset($arParams['yAxis'])) {
                throw new Exception\ArgumentNullException('arParams[yAxis]');
            }
            if (!isset($arParams['valueSuffix'])) {
                throw new Exception\ArgumentNullException("arParams[valueSuffix]");
            }
            if (!isset($arParams['series'])) {
                throw new Exception\ArgumentNullException('arParams[series]');
            }
            if (!isset($arParams['container'])) {
                $containerName = $arParams['container'] = 'line_charts';
            } else {
                $containerName = $arParams['container'];
            }
        }
    } catch (Exception\ArgumentNullException $e) {
        die($e->showException());
    } catch (Exception\ArgumentOutOfRangeException $e1) {
        die($e1->showException());
    }
    Lib\Buffer::addJS(Lib\Config::getConfig("CORE_ROOT") . "js/highcharts.js");
    Lib\Buffer::addJS(Lib\Config::getConfig("CORE_ROOT") . "js/exporting.js");
    $arHighCharts = array('title' => array('text' => $arParams['title'], 'x' => -20), 'subtitle' => array('text' => $arParams['subtitle'], 'x' => -20), 'xAxis' => array('categories' => $arParams['xAxis']), 'yAxis' => array('title' => array('text' => $arParams['yAxis']), 'plotLines' => array(0 => array('value' => 0, 'width' => 1, 'color' => '#808080'))), 'tooltip' => array('valueSuffix' => $arParams['valueSuffix']), 'legend' => array('layout' => 'vertical', 'align' => 'right', 'verticalAlign' => 'middle', 'borderWidth' => 0), 'series' => $arParams['series']);
    $echo = '<div id="' . $containerName . '" style="min-width: 310px; height: 400px; margin: 0 auto"></div>' . "\n";
    $echo .= '<script type="text/javascript">' . "\n\t" . "\$(function () {\n\t\t" . "\$('#" . $containerName . "').highcharts(" . json_encode($arHighCharts) . ");\n\t" . "});\n" . "</script>\n";
    return $echo;
}
Exemple #12
0
 public static function getUploadDir()
 {
     return Config::getConfig("MSERGEEV_ROOT") . "upload/";
 }
Exemple #13
0
<?php

/**
 * MSergeev
 * @package core
 * @author Mikhail Sergeev
 * @copyright 2016 Mikhail Sergeev
 */
//echo __FILE__."<br>";
include_once \MSergeev\Core\Lib\Config::getConfig('CORE_ROOT') . 'tools.php';
__include_once(\MSergeev\Core\Lib\Config::getConfig('CORE_ROOT') . 'core.php');
//Вместо автоматической подгрузки всех пакетов, пакеты подгружаются классом Loader там, где необходимо
//__include_once(\MSergeev\Core\Lib\Config::getConfig('PACKAGES_ROOT').'packages.php');
Exemple #14
0
<?php

/**
 * MSergeev
 * @package core
 * @author Mikhail Sergeev
 * @copyright 2016 Mikhail Sergeev
 */
use MSergeev\Core\Lib;
__include_once(Lib\Config::getConfig('CORE_ROOT') . "lib/data_base.php");
$DB = new Lib\DataBase();
$GLOBALS['DB'] = $DB;
__include_once(Lib\Config::getConfig('CORE_ROOT') . "lib/options.php");
Lib\Options::init();
__include_once(Lib\Config::getConfig('CORE_ROOT') . "lib/loader.php");
Lib\Loader::init();
__include_once(Lib\Config::getConfig('CORE_ROOT') . "lib/users.php");
$USER = new Lib\Users();
$GLOBALS['USER'] = $USER;
//***** Exception ********
Lib\Loader::includeFiles(Lib\Config::getConfig('CORE_ROOT') . "exception/", array("system_exception.php", "argument_exception.php", "db_exception.php", "sql_exception.php", "io_exception.php"));
//***** Lib *********
Lib\Loader::includeFiles(Lib\Config::getConfig('CORE_ROOT') . "lib/", array(), array("data_base.php", "options.php", "config.php", "loader.php", "users.php"));
Lib\Loc::setModuleMessages();
//***** Entity ********
Lib\Loader::includeFiles(Lib\Config::getConfig('CORE_ROOT') . "entity/", array("field.php", "scalar_field.php", "date_field.php"));
//***** Tables ********
Lib\Loader::includeFiles(Lib\Config::getConfig('CORE_ROOT') . "tables/");
Exemple #15
0
 public static function getSitePath($path)
 {
     return str_replace(Config::getConfig("SITE_ROOT"), "", $path);
 }
Exemple #16
0
<?php

/**
 * MSergeev
 * @package core
 * @author Mikhail Sergeev
 * @copyright 2016 Mikhail Sergeev
 */
// ---- SETUP ----
$packageName = "finances";
// ---------------
use MSergeev\Core\Lib\Config;
use MSergeev\Core\Lib\Loader;
$packageNameToUpper = strtoupper($packageName);
Config::addConfig($packageNameToUpper . '_ROOT', Config::getConfig('PACKAGES_ROOT') . $packageName . "/");
Config::addConfig($packageNameToUpper . '_PUBLIC_ROOT', Config::getConfig('PUBLIC_ROOT') . $packageName . "/");
Config::addConfig($packageNameToUpper . '_TOOLS_ROOT', str_replace(Config::getConfig("SITE_ROOT"), "", Config::getConfig('PACKAGES_ROOT') . $packageName . "/tools/"));
//***** Tables ********
Loader::includeFiles(Config::getConfig($packageNameToUpper . '_ROOT') . "tables/");
//***** Lib ********
Loader::includeFiles(Config::getConfig($packageNameToUpper . '_ROOT') . "lib/");
Exemple #17
0
			</tr>
			<tr>
				<td><input class="submit" type="submit" name="submit" value="Добавить"></td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
		</table>
	</form>

	<script type="text/javascript">
		$(document).on("ready",function(){
			$('#car_brand').on('change',function(){
				var brand_id = $(this).val();
				$.post(
					"<?php 
    echo \MSergeev\Core\Lib\Config::getConfig("ICAR_TOOLS_ROOT") . 'get_select_model.php';
    ?>
",
					{
						brand_id: brand_id
					},
					function(data) {
						console.log(data);
						if (data.status == 'ok')
						{
							$('.td_model').html(data.select);
						}
						else
						{
							$('.td_model').html('<?php 
    echo InputType('text', 'car_model_text', '', '', false, '', 'class="car_model_text"');