public static function addJS($path) { if (file_exists($path)) { $path = Tools::getSitePath($path); if (!in_array($path, static::$arIncludedJS)) { static::$arIncludedJS[] = $path; if (static::$includedJS != "") { static::$includedJS .= "\t\t"; } static::$includedJS .= '<script type="text/javascript" src="' . $path . '"></script>' . "\n"; } } }
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()"); } }
public static function showListTable($carID = null) { if (is_null($carID)) { $carID = MyCar::getDefaultCarID(); } $arList = static::getTsList($carID); if ($arList) { echo '<div id="tsList"></div><div id="tsPager"></div>'; $dateHelper = new CoreLib\DateHelper(); $imgSrcPath = CoreLib\Tools::getSitePath(CoreLib\Loader::getTemplate('icar') . "images/"); //msDebug($arList); $arDatas = array(); foreach ($arList as $list) { $arDatas[] = array('id' => $list['ID'], 'ts' => "ТО-" . $list['TS_NUM'], 'date' => $list['DATE'], 'timestamp' => "=" . $dateHelper->getDateTimestamp($list['DATE']), 'odo' => "=" . $list['ODO'], 'cost' => "=" . $list['COST'], 'executors_name' => $list['EXECUTORS_NAME'], 'point_name' => $list['POINT_NAME'], 'point_latitude' => $list['POINT_LATITUDE'], 'point_longitude' => $list['POINT_LONGITUDE'], 'yandex_map' => "<img src='https://static-maps.yandex.ru/1.x/?l=map&z=12&size=600,450&pt=" . $list['POINT_LONGITUDE'] . "," . $list['POINT_LATITUDE'] . ",pm2blm'>", 'point_type' => $list['POINT_TYPE_NAME'], 'info' => strlen($list['INFO']) > 0 ? "<img src='" . $imgSrcPath . "info.png'>" : "", 'comment' => $list['INFO'], 'edit' => "<a href='edit.php?id=" . $list['ID'] . "'><img src='" . $imgSrcPath . "edit.png'></a>", 'delete' => "<a href='delete.php?id=" . $list['ID'] . "'><img src='" . $imgSrcPath . "delete.png'></a>"); } $webixHelper = new IcarWebixHelper(); $webixHelper->addFunctionSortByTimestamp(); $arData = array('grid' => 'tsGrid', 'container' => 'tsList', 'footer' => true, 'tooltip' => true, 'pager' => array('container' => 'tsPager'), 'columns' => array($webixHelper->getColumnArray('DATE', array('footer' => '={text:"Итого:", colspan:3}')), $webixHelper->getColumnArray('TS'), $webixHelper->getColumnArray('ODO'), $webixHelper->getColumnArray('EXECUTORS'), $webixHelper->getColumnArray('COST', array('footer' => '={ content:"summColumn" }')), $webixHelper->getColumnArray('POINT'), $webixHelper->getColumnArray('INFO'), $webixHelper->getColumnArray('EDIT'), $webixHelper->getColumnArray('DELETE')), 'data' => $arDatas); return CoreLib\Webix::showDataTable($arData); } else { echo 'Нет данных о прохождении ТО'; return false; } }
<?php use MSergeev\Core\Lib; use MSergeev\Packages\Icar\Lib as CarLib; $path = Lib\Tools::getSitePath(Lib\Loader::getPublic("icar")); //Lib\Loc::setModuleMessages('icar'); $arAlerts = CarLib\MyCar::checkAlerts(); //msDebug($arAlerts); foreach ($arAlerts as $alert) { ?> <div class="alert_<?php echo $alert['COLOR']; ?> "><?php echo $alert['TEXT']; ?> </div> <?php } ?> <style> .alert_green { width: 95%; margin: 5px; padding: 10px; border: 1px solid darkgreen; background: lightgreen; color: darkgreen; text-align: justify; } .alert_yellow {
<?php use MSergeev\Core\Lib; $path = Lib\Tools::getSitePath(Lib\Loader::getPublic("tasks")); ?> <table class="top_menu"> <tr> <td><a href="<?php echo $path; ?> ">Главная</a></td> <td><a href="<?php echo $path; ?> tasks/">Задачи</a></td> <td><a href="<?php echo $path; ?> groups/">Группы задач</a></td> <?php /*<td><a href="<?=$path?>notice/">Напоминания</a></td> <td><a href="<?=$path?>actions/">Действия</a></td>*/ ?> </tr> </table>
<?php use MSergeev\Core\Lib; $path = Lib\Tools::getSitePath(Lib\Loader::getPublic("icar")); $imgPath = Lib\Tools::getSitePath(Lib\Loader::getTemplate("icar") . "images/"); $imgWidth = $imgHeight = 50; Lib\Loc::setModuleMessages('icar'); ?> <table class="top_menu"> <tr> <td> <div style="text-align: center;"> <a href="<?php echo $path; ?> " id="main" class="top_menu_link"> <img src="<?php echo $imgPath; ?> main.png" width="<?php echo $imgWidth; ?> " height="<?php echo $imgHeight; ?> " border="0" alt="Главная"> <br><?php echo Lib\Loc::getMessage('ms_icar_menu_main'); ?> </a> </div>
<?php include_once __DIR__ . "/../include/header.php"; MSergeev\Core\Lib\Buffer::setTitle("События"); use MSergeev\Core\Lib; $path = Lib\Tools::getSitePath(Lib\Loader::getPublic("events")); ?> <a href="<?php echo $path; ?> events/add.php">Добавить событие</a> <?php include_once MSergeev\Core\Lib\Loader::getPublic("events") . "include/footer.php";
/** * getClassName - функция возвращает название класса по имени таблицы, используя функцию Tools::getClassNameByTableName('table') * * @return string */ public static function getClassName() { return Tools::getClassNameByTableName(static::getTableName()); }
private function checkCanDelete($query = null) { try { if (is_null($query)) { throw new Exception\ArgumentNullException('query'); } } catch (Exception\ArgumentNullException $e) { $e->showException(); return false; } $primaryId = $query->getDeletePrimary(); $arTableLinks = $query->getTableLinks(); $bCanDelete = true; foreach ($arTableLinks as $field => $arLinked) { foreach ($arLinked as $linkTable => $linkField) { if (is_array($linkField)) { foreach ($linkField as $linkF) { $arRes = Lib\Tools::runTableClassFunction($linkTable, 'getListFunc', array(array('select' => array('ID'), 'filter' => array($linkF => $primaryId)))); if ($arRes) { $bCanDelete = false; } } } else { $arRes = Lib\Tools::runTableClassFunction($linkTable, 'getListFunc', array(array('select' => array('ID'), 'filter' => array($linkField => $primaryId)))); if ($arRes) { $bCanDelete = false; } } } } return $bCanDelete; }