Ejemplo n.º 1
0
 public function __construct($REQUEST, $model, $view)
 {
     $UI = \CORE\UI::init();
     switch ($REQUEST->get('act')) {
         case 'add':
             $model->create();
             break;
         case 'get':
             $model->get();
             break;
         case 'update':
             $model->update();
             break;
         case 'del':
             $model->delete();
             break;
         default:
             $UI->pos['main'] .= $view->main($model);
             break;
     }
     if (\CORE::init()->is_ajax()) {
         \DB::init()->close();
         exit;
     }
 }
Ejemplo n.º 2
0
 public function main($model)
 {
     if ($model != null) {
         $UI = \CORE\UI::init();
         // $sample=['controller']['action'][0]['125']=1;
         $UI->pos['main'] .= '';
     }
 }
Ejemplo n.º 3
0
 public function __construct($REQUEST, $model, $view)
 {
     switch ($REQUEST->get('act')) {
         default:
             \CORE\UI::init()->static_page($REQUEST->get('act'));
             break;
     }
 }
Ejemplo n.º 4
0
Archivo: ui.php Proyecto: sniyozov/mt
 public function render()
 {
     global $conf;
     // start to count exec time, in index.php
     $UI = \CORE\UI::init();
     if ($UI->tpl() != '') {
         include $UI->tpl();
     }
 }
Ejemplo n.º 5
0
 public function __construct($REQUEST, $model, $view)
 {
     $UI = \CORE\UI::init();
     switch ($REQUEST->get('act')) {
         case 'km1':
             $UI->pos['main'] .= $view->km1($model);
             break;
         default:
             $UI->pos['main'] .= $view->main($model);
             break;
     }
     if (\CORE::init()->is_ajax()) {
         \DB::init()->close();
         exit;
     }
 }
Ejemplo n.º 6
0
Archivo: mt_v.php Proyecto: sniyozov/mt
    public function main($model)
    {
        $lang = \CORE::lng();
        $UI = \CORE\UI::init();
        $result = '<div><h4>' . \CORE::t('mt', 'Образовательные учреждения') . ':</h4></div>';
        $mt = $model->get_mt();
        $mt_types = $model->get_mt_types();
        $mt_count = count($mt);
        $result .= '<p><strong>' . \CORE::t('filter', 'Фильтр') . ':</strong> ' . \CORE::t('types', 'Типы') . ' 
	' . $UI->html_list($mt_types, '', ' id="type"', $model->selected_type, '-- ' . \CORE::t('all', 'Все') . ' --') . '<p>';
        $result .= '<p>' . $UI->bootstrap_modal_btn('show_newModal', 'newModal', \CORE::t('add_mt', 'Добавить учреждение')) . '</p>';
        if ($mt_count > 0) {
            $geo = $model->get_geo_objects();
            $result .= '
<table class="table table-bordered table-hover" style="width:auto;">
	<thead>
	<tr>
	<th>№</th>
	<th>' . \CORE::t('type', 'Тип') . '</th>
	<th>' . \CORE::t('mt_name', 'Название учреждения') . '</th>
	<th>ID</th>
	<th>' . \CORE::t('geo', 'География') . '</th>
	<th>' . \CORE::t('address', 'Адрес') . '</th>
	<th class="text-center">' . \CORE::t('action', 'Действие') . '</th>
	</tr>
	</thead>
<tbody>
';
            $cnt = 0;
            foreach ($mt as $mt_id => $mt_val) {
                $cnt++;
                $mt_type = '';
                if (isset($mt_types[$mt_val['mt-type']])) {
                    $mt_type = $mt_types[$mt_val['mt-type']];
                }
                $mt_geo = '';
                if (isset($geo[$mt_val['mt-geo-id']])) {
                    $mt_geo = $geo[$mt_val['mt-geo-id']];
                }
                $result .= '
<tr>
<td>' . $cnt . '</td>
<td>' . $mt_type . '</td>
<td>' . $mt_val['mt-name-' . $lang] . '</td>
<td>' . $mt_id . '</td>
<td>' . $mt_geo . '</td>
<td>' . $mt_val['mt-address'] . '</td>
<td>
<div id="' . $mt_id . '" class="btn-group btn-group-xs">
	<button type="button" class="btn btn-default edit" data-toggle="modal" data-target="#editModal">' . \CORE::t('edit', 'изменить') . '</button>
	<button type="button" class="btn btn-default delete">' . \CORE::t('delete', 'удалить') . '</button>
</div>
</td>
</tr>
';
            }
            $result .= '</tbody>
		</table>
		';
        } else {
            \CORE::msg('info', \CORE::t('no_mt', 'В базе не найдены образовательные учреждения'));
        }
        $geo_info = '';
        $geo_list = $model->get_gid_geo_objects();
        if (count($geo_list) > 0) {
            // totdo !!! change for all groups - gid
            $geo_info = '
		<div class="form-group">
			<label for="new_geo">' . \CORE::t('location', 'Расположение') . '</label>
			' . $UI->html_list($geo_list, '', ' id="new_geo" class="form-control"') . '
		</div>';
        }
        $new_body = $geo_info . '
  <div class="form-group">
    <label for="new_type">' . \CORE::t('type', 'Тип') . '</label>
	' . $UI->html_list($mt_types, '', ' id="new_type" class="form-control"', $model->selected_type) . '
  </div>
  <div class="form-group">
    <label for="new_name_ru">' . \CORE::t('mt_name', 'Название учреждения') . ' (RU)</label>
    <input type="text" class="form-control" id="new_name_ru" placeholder="Название">
  </div>
  <div class="form-group">
    <label for="new_name_tj">' . \CORE::t('mt_name', 'Название учреждения') . ' (TJ)</label>
    <input type="text" class="form-control" id="new_name_tj" placeholder="Номи муассиса">
  </div>
  <div class="form-group">
    <label for="new_director">Директор</label>
    <input type="text" class="form-control" id="new_director" placeholder="Ф.И.О.">
  </div>
  <div class="form-group">
    <label for="new_address">' . \CORE::t('address', 'Адрес') . '</label>
    <input type="text" class="form-control" id="new_address" placeholder="' . \CORE::t('address', 'Адрес') . '">
  </div>
  <div class="form-group">
    <label for="new_phone">Телефон</label>
    <input type="text" class="form-control" id="new_phone" placeholder="">
  </div>
  <div class="form-group">
    <label for="new_mobile">' . \CORE::t('mobile', 'Мобильный') . '</label>
    <input type="text" class="form-control" id="new_mobile" placeholder="9XXXXXXXX">
  </div>
  <hr>
  <div class="form-group">
    <div class="row">
    	<div class="col-md-6">
    		<label for="new_geo_lat">Latitude</label>
    		<input type="text" class="form-control" id="new_geo_lat" placeholder="38.XXXXXXX">
    	</div>
    	<div class="col-md-6">
    		<label for="new_geo_lng">Longitude</label>
    		<input type="text" class="form-control" id="new_geo_lng" placeholder="68.XXXXXXX">
    	</div>
    </div>
  </div>
	';
        $result .= $UI->bootstrap_modal('newModal', \CORE::t('new_mt', 'Новое учреждение') . ':', '', $new_body, 'addNew', \CORE::t('add', 'Добавить'));
        $UI->pos['js'] .= '
<script>
$(document).ready(function() {

	$("#type").change(function(){
		var sel_type = $(this).val();
		if(sel_type>0){
			window.location.href="./?c=mt&type="+sel_type;
		} else {
			window.location.href="./?c=mt";
		}
	});

	$("#addNew").click(function(e){
		e.preventDefault();
		alert("add...");
	});

	$(".edit").click(function(){
		var edit_id = $(this).parent("div").attr("id");

	});

	$(".delete").click(function(){
		var del_id = $(this).parent("div").attr("id");
		if(confirm("' . \CORE::t('delete', "Удалить") . '?")){
			$.post("./?c=mt&act=del&ajax", {id: del_id}, function(data){
				if(data=="deleted"){
					location.reload();
				} else {
					alert("Error, check js log...");
					console.log(data);
				}
			});
		}
	});

});
</script>
	';
        return $result;
    }
Ejemplo n.º 7
0
    public function main($model)
    {
        $UI = \CORE\UI::init();
        $modules_list = $model->get_list_of_modules();
        $result = '<div>
	<h4>' . mb_convert_case(\CORE::t('translation', 'Translation'), MB_CASE_TITLE, "UTF-8") . ':</h4>
	' . \CORE::t('module', 'Модуль') . ': ' . $UI->html_list($modules_list, '', ' id="sel_module"', $model->sel_module) . '
	<!-- (Ҷҷ, Ӯӯ, Ққ, Ӣӣ, Ғғ, Ҳҳ) -->
	' . $UI::bootstrap_modal_btn('add_new_translation', 'new_translation', \CORE::t('new_translation', 'Новый перевод')) . '
	</div><br>';
        $translations = $model->get_translations($model->sel_module);
        $translations_counter = count($translations);
        // modal: new
        $new_translation_body = '
<div class="form-group">
	<label for="alias">Alias</label>
	<input type="text" class="form-control" id="alias" placeholder="short_latin_txt" style="width:200px;">
</div>
<div class="form-group">
	<label for="ru_txt">RU</label>
	<input type="text" class="form-control" id="ru_txt" placeholder="Перевод">
</div>
<div class="form-group">
	<label for="tj_txt">TJ</label>
	<input type="text" class="form-control" id="tj_txt" placeholder="Тарҷума"><br>
	<span class="text-muted">Ҷҷ, Ӯӯ, Ққ, Ӣӣ, Ғғ, Ҳҳ</span>
</div>
		';
        $result .= $UI::bootstrap_modal('new_translation', \CORE::t('new_translation', 'Новый перевод') . ':', '', $new_translation_body, 'create_new_translation', \CORE::t('add', 'Добавить'));
        $UI->pos['js'] .= '
<script>
$(document).ready(function() {

	function IsJsonString(str) {
    	try { JSON.parse(str); } catch(e) { return false; }
    	return true;
	}

	$("#sel_module").change(function(){
		window.location.href = "./?c=translation&sel_module=" + $(this).val();
	});

	$("#create_new_translation").click(function(e){
		e.preventDefault();
		var new_alias=$("#alias").val();
		var new_ru=$("#ru_txt").val();
		var new_tj=$("#tj_txt").val();
		$.post("./?c=translation&act=add&sel_module="+$("#sel_module").val()+"&ajax", {alias: new_alias, ru: new_ru, tj: new_tj}, function(data){
			if(data=="created"){
				location.reload();
			} else {
				alert("Error, check js log...");
				console.log(data);
			}
		});
	});

	$(".edit_translation").click(function(e){
		var get_module=$("#sel_module").val();
		var get_alias=$(this).parent("div").attr("id");
		$.post("./?c=translation&act=get&ajax", {module: get_module, alias: get_alias}, function(data){
			if(IsJsonString(data)){
				var obj = JSON.parse(data);
				$("#edit_module").val(obj.module);
				$("#edit_alias").val(obj.alias);
				$("#edit_ru_txt").val(obj.ru);
				$("#edit_tj_txt").val(obj.tj);
			} else {
				alert("Error, check js log...");
				console.log(data);
			}
		});
	});

	$("#update_translation").click(function(e){
		e.preventDefault();
		var edit_module=$("#edit_module").val();
		var edit_alias=$("#edit_alias").val();
		var edit_ru=$("#edit_ru_txt").val();
		var edit_tj=$("#edit_tj_txt").val();
		$.post("./?c=translation&act=update&ajax", {module: edit_module, alias: edit_alias, ru: edit_ru, tj: edit_tj}, function(data){
			if(data=="updated"){
				location.reload();
			} else {
				alert("Error, check js log...");
				console.log(data);
			}
		});
	});

	$(".del_translation").click(function(){
		var del_alias = $(this).parent("div").attr("id");
		if(confirm("' . \CORE::t('delete', 'Удалить') . '?")){
			$.post("./?c=translation&act=del&sel_module="+$("#sel_module").val()+"&ajax", {alias: del_alias}, function(data){
				if(data=="deleted"){
					location.reload();
				} else {
					alert("Error, check js log...");
					console.log(data);
				}
			});
		}
	});

});
</script>';
        if ($translations_counter > 0) {
            $result .= '
		<table class="table table-bordered table-hover" style="width:auto;">
		<thead>
		<tr>
		<th>№</th>
		<th>' . \CORE::t('alias', 'Псевдоним') . '</th>
		<th>RU</th>
		<th>TJ</th>
		<th class="text-center">' . \CORE::t('action', 'Действие') . '</th>
		</tr>
		</thead>
		<tbody>
		';
            $cnt = 0;
            foreach ($translations as $alias => $t_array) {
                $cnt++;
                $result .= '
			<tr>
			<td>' . $cnt . '</td>
			<td>' . $alias . '</td>
			<td>' . $t_array['ru'] . '</td>
			<td>' . $t_array['tj'] . '</td>
			<td>
			<div id="' . $alias . '" class="btn-group btn-group-xs">
				<button type="button" class="btn btn-default edit_translation" data-toggle="modal" data-target="#editModal">' . \CORE::t('edit', 'изменить') . '</button>
				<button type="button" class="btn btn-default del_translation">' . \CORE::t('delete', 'Удалить') . '</button>
			</div>
			</td>
			</tr>
			';
            }
            $result .= '</tbody>
		</table>
		<span class="text-muted">
		P.S. Example of using this in the code: CORE::t("alias","Default translation");
		</span>
		';
            // modal: edit
            $edit_translation_body = '
<div class="form-group">
	<label for="edit_module">' . \CORE::t('module', 'Модуль') . '</label>
	' . $UI->html_list($modules_list, '', ' id="edit_module" class="form-control" disabled', $model->sel_module) . '
</div>
<div class="form-group">
	<label for="edit_alias">' . \CORE::t('alias', 'Псевдоним') . '</label>
	<input type="text" class="form-control" id="edit_alias" placeholder="short_latin_txt" style="width:200px;" disabled>
</div>
<div class="form-group">
	<label for="edit_ru_txt">RU</label>
	<input type="text" class="form-control" id="edit_ru_txt" placeholder="Перевод">
</div>
<div class="form-group">
	<label for="edit_tj_txt">TJ</label>
	<input type="text" class="form-control" id="edit_tj_txt" placeholder="Тарҷума"><br>
	<span class="text-muted">Ҷҷ, Ӯӯ, Ққ, Ӣӣ, Ғғ, Ҳҳ</span>
</div>
		';
            $result .= $UI::bootstrap_modal('editModal', \CORE::t('edit', 'Редактирование') . ':', '', $edit_translation_body, 'update_translation', \CORE::t('update', 'Обновить'));
        } else {
            $result .= '<h4 class="text-danger">' . \CORE::t('no_translations_yet', 'Здесь пока нет переводов') . '</h4>';
        }
        return $result;
    }
Ejemplo n.º 8
0
    public function main($model)
    {
        $result = '';
        $groups = $model->get_groups();
        $counter = count($groups);
        $UI = \CORE\UI::init();
        $result .= '<div>
	<h4>Groups: <span class="badge">' . $counter . '</span>&nbsp;
	' . $UI::bootstrap_modal_btn('ShowNewGroup', 'NewGroup', 'New group') . '
	</h4>
</div>
';
        $modal_body_new = '<div class="form-group">
	<label for="new_group">Group name</label>
	<input type="text" class="form-control" id="new_group" placeholder="">
</div>
';
        $result .= $UI::bootstrap_modal('NewGroup', 'New group', ' id="frm_NewGroup"', $modal_body_new, 'addGroup', 'Add');
        $modal_body_edit = '<div class="form-group">
	<input type="hidden" id="gid" value="0">
	<label for="edit_group">Group name</label>
	<input type="text" class="form-control" id="edit_group" placeholder="">
</div>
';
        $result .= $UI::bootstrap_modal('EditGroup', 'Edit group', ' id="frm_EditGroup"', $modal_body_edit, 'updateGroup', 'Update');
        if ($counter > 0) {
            $result .= '
<table class="table table-bordered table-hover" style="width:auto;">
<thead>
<tr>
<th>#</th>
<th>Group</th>
<th>gid</th>
<th class="text-center">ACTION</th>
</tr>
</thead>
<tbody>
';
            $cnt = 0;
            foreach ($groups as $gid => $group) {
                $cnt++;
                $result .= '
<tr>
	<td>' . $cnt . '</td>
	<td>' . $group . '</td>
	<td>' . $gid . '</td>
	<td>
	<div id="' . $gid . '" class="btn-group btn-group-xs">
		<button type="button" class="btn btn-default group_edit" data-toggle="modal" data-target="#EditGroup">edit</button>
		<button type="button" class="btn btn-default group_del">delete</button>
	</div>
	</td>
</tr>
';
            }
            $result .= '</tbody></table>';
        } else {
            $result .= '<div class="well">' . \CORE::init()->lang('norecdb', 'No records found in the database.') . '</div>';
        }
        $UI->pos['js'] .= '
<script type="text/javascript">
	$(document).ready(function(){

		// ADD

		function IsJsonString(str) {
	    	try { JSON.parse(str); } catch(e) { return false; }
	    	return true;
		}

		$("#NewGroup").on("shown.bs.modal", function() {
		    $("#new_group").focus();
		});

		$("#frm_NewGroup").submit(function(e){
			e.preventDefault();
		});

		$("#addGroup").click(function(){
			var new_group = $("#new_group").val();
			$.post("./?c=group&act=add&ajax=add", {newgroup:new_group}, function(data){
				if(data=="Group successfully added."){
					location.reload();
				} else {
					alert("Error. Check JS console log.");
					console.log(data);
				}
			});
		});

		// EDIT
		
		$("#EditGroup").on("shown.bs.modal", function() {
		    $("#edit_group").focus();
		});

		$("#frm_EditGroup").submit(function(e){
			e.preventDefault();
		});

		$("button.group_edit").click(function(){
			var xgid = $(this).parent("div").attr("id");
			$.post("./?c=group&act=edit&ajax", {gid:xgid}, function(data){
				if(IsJsonString(data)){
					var obj = JSON.parse(data);
					$("#gid").val(xgid);
					$("#edit_group").val(obj.group);					
				} else {
					alert("Error. Check JS console log.");
					console.log(data);
				}
			});
		});

		// UPDATE

		$("#updateGroup").click(function(){
			var edit_gid = $("#gid").val();
			var edit_group = $("#edit_group").val();
			$.post("./?c=group&act=update&ajax", {gid:edit_gid,group:edit_group}, function(data){
				if(data=="Group successfully updated."){
					location.reload();
				} else {
					alert("The operation failed. Check JS console log.");
					console.log(data);
				}
			});
		});

		// DEL

		$("button.group_del").click(function(){
			var del_gid = $(this).parent("div").attr("id");
			if(confirm("Delete this group?")){
				$.post("./?c=group&act=del&ajax", {gid:del_gid}, function(data){
					if(data=="Group successfully deleted."){
						location.reload();
					} else {
						alert("Error. Check JS console log.");
						console.log(data);
					}
				});
			}
		});

	});
</script>	
';
        return $result;
    }
Ejemplo n.º 9
0
    public function show()
    {
        \CORE::msg('debug', 'umenu');
        $UI = \CORE\UI::init();
        $USER = \USER::init();
        $UI->pos['js'] .= '
<script>
$(document).ready(function() {

	function change_language(xlang){
		$.post("./?lang="+xlang, function(){
			location.reload();
		});
	}  

	$("a.change_language").click(function(e){
		e.preventDefault();
		var xlang = $(this).attr("rel");
		change_language(xlang);
	});

});
</script>
';
        if ($USER->auth()) {
            // authorized users
            $UI->pos['mainmenu'] .= '
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('reports', 'Отчеты') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
              	<li class="dropdown-header">' . \CORE::t('input_forms', 'Формы ввода данных:') . '</li>
              	<li class="divider"></li>
                <li><a href="./?c=frm&act=ps">' . \CORE::t('mt_frm_passport', 'Паспорт образовательного учреждения') . '</a></li>
                <li><a href="./?c=frm&act=bmt1">' . \CORE::t('mt_frm_bmt1', 'Форма БМТ-1') . '</a></li>
                <li><a href="./?c=frm&act=kom1">' . \CORE::t('mt_frm_kom1', 'Форма КОМ-1') . '</a></li>
                <li><a href="./?c=frm&act=tm1">' . \CORE::t('mt_frm_tm1', 'Форма ОШ-1') . '</a></li>
                <li><a href="./?c=frm&act=fb">' . \CORE::t('mt_frm_fb', 'Форма ФБ') . '</a></li>
                <li><a href="./?c=frm&act=km1">' . \CORE::t('mt_frm_km1', 'Форма КМ-1') . '</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('statistic', 'Статистика') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=stat">----</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('visualization', 'Визуализация') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=map">' . \CORE::t('map', 'Карта') . '</a></li>
                <li><a href="./?c=vs">' . \CORE::t('datavisual', 'Визуализация данных') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('opendata', 'Открытые данные') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about_opendata">' . \CORE::t('about_opendata', 'Об открытых данных') . '</a></li>
                <li><a href="./?c=od">' . \CORE::t('opendata', 'Открытые данные') . '</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('zayavki', 'Заявки') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=apps&act=create">' . \CORE::t('reg_form', 'Форма регистрации') . '</a></li>
                <li><a href="./?c=apps&act=status_check">' . \CORE::t('check_app', 'Проверить статус заявки') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('project', 'Проект') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about">' . \CORE::t('about_project', 'Описание проекта') . '</a></li>
                <li><a href="./?c=page&act=team">' . \CORE::t('project_team', 'Команда проекта') . '</a></li>
              </ul>
            </li>
			';
            $UI->pos['user1'] .= '
			<ul class="nav navbar-nav">
				' . LANGUAGE::SWITCHER(true) . '
				<li class="dropdown">
	              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
				  <small><i class="glyphicon glyphicon-cog"></i>&nbsp;</small>
				  ' . $USER->get('username') . '
	              <span class="caret"></span></a>
	              <ul class="dropdown-menu">
	                <!--<li>
	                	<a href="./?c=user&act=profile">
	                		<small><i class="glyphicon glyphicon-user"></i>&nbsp;</small> 
				    		<span class="text">' . \CORE::t('profile', 'Профиль') . '</span>
	                	</a>
	                </li>-->
	                <!--<li>
	                	<a href="./?c=user&act=change_password">
	                		<small><i class="glyphicon glyphicon-pencil"></i>&nbsp;</small> 
				    		<span class="text">' . \CORE::t('cpasswd', 'Сменить пароль') . '</span>
	                	</a>
	                </li>
	                -->
	                <li class="divider"></li>
	                <li>
	                	<a href="./?c=user&act=logout">
	                		<small><i class="glyphicon glyphicon-off"></i>&nbsp;</small> 
				    		<span class="text">' . \CORE::t('logout', 'Logout') . '</span>
	                	</a>
	                </li>
	              </ul>
	            </li>
		    </ul>
			';
        } else {
            // guests
            $UI->pos['mainmenu'] .= '
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('visualization', 'Визуализация') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=map">' . \CORE::t('map', 'Карта') . '</a></li>
                <li><a href="./?c=vs">' . \CORE::t('datavisual', 'Визуализация данных') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('opendata', 'Открытые данные') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about_opendata">' . \CORE::t('about_opendata', 'Об открытых данных') . '</a></li>
                <li><a href="./?c=od">' . \CORE::t('opendata', 'Открытые данные') . '</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('zayavleniya', 'Заявления') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=apps&act=create">' . \CORE::t('reg_form', 'Форма регистрации') . '</a></li>
                <li><a href="./?c=apps&act=status_check">' . \CORE::t('check_app', 'Проверить статус заявки') . '</a></li>
              </ul>
            </li>
			<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
              ' . \CORE::t('about', 'О проекте') . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="./?c=page&act=about">' . \CORE::t('about_project', 'Описание проекта') . '</a></li>
                <li><a href="./?c=page&act=team">' . \CORE::t('team', 'Команда проекта') . '</a></li>
              </ul>
            </li>
			';
            $UI->pos['user1'] .= '<form action="./?c=user&act=login" method="post" class="navbar-form">
			' . LANGUAGE::SWITCHER();
            $UI->pos['user1'] .= '<div class="form-group">
					<input type="text" name="login" placeholder="' . \CORE::t('login', 'Login') . '" value="' . \COOKIE::get('lastuser') . '" class="form-control" style="width:150px;">
				</div>
				<div class="form-group">
					<input type="password" name="password" placeholder="' . \CORE::t('password', 'Password') . '" class="form-control" style="width:150px;">
				</div>
				<button type="submit" class="btn btn-warning">' . \CORE::t('login', 'Login') . '</button>
			';
            $UI->pos['user1'] .= '</form>
			';
        }
    }
Ejemplo n.º 10
0
Archivo: main.php Proyecto: sniyozov/mt
<?php

if (!defined('DIR_BASE')) {
    echo '[+_+]';
    exit;
}
if (is_readable(DIR_CORE . '/classes/core.php')) {
    require DIR_CORE . '/classes/core.php';
} else {
    echo 'class CORE not found';
    exit;
}
$CORE = CORE::init();
$USER = USER::init();
$UI = \CORE\UI::init();
$APP = \CORE\APP::init();
$APP->run();
$APP->stop();
$UI->render();
Ejemplo n.º 11
0
Archivo: run.php Proyecto: sniyozov/mt
<?php

$pages = array('home' => 'home', 'user' => 'user', 'admin' => 'admin', 'about' => 'about', 'about_opendata' => 'about_opendata', 'team' => 'team');
\CORE\UI::init()->set_pages($pages);
\CORE::init()->set_modules(array('mt' => 1, 'frm' => 1, 'stat' => 1, 'map' => 1, 'vs' => 1, 'od' => 1, 'apps' => 1, 'translation' => 1));
$USER = \USER::init();
if ($USER->auth()) {
    // for authorized users (!) because of $DB->connect()
    // load translations from DB
    $new_lng = array();
    $c_lang = \CORE::lng();
    $DB = \DB::init();
    if ($DB->connect()) {
        if (\CORE::get_c() != '') {
            $sql = "SELECT * FROM `mt-translation` WHERE `t-module`=:module OR `t-module`='all';";
            $sth = $DB->dbh->prepare($sql);
            $sth->execute(array('module' => \CORE::get_c()));
        } else {
            $sql = "SELECT * FROM `mt-translation` WHERE `t-module`='all';";
            $sth = $DB->dbh->prepare($sql);
            $sth->execute();
        }
        $DB->query_count();
        if ($sth->rowCount() > 0) {
            while ($r = $sth->fetch()) {
                $new_lng[$r['t-alias']] = $r['t-' . $c_lang];
            }
        }
    }
    \CORE::msg('debug', 'load translations from DB');
    \CORE::set_lng($new_lng);
Ejemplo n.º 12
0
Archivo: core.php Proyecto: sniyozov/mt
 public static function ROUTER()
 {
     $REQUEST = \CORE::init()->request;
     \CORE::init()->c = $REQUEST->get('c');
     $USER = USER::init();
     $modules = \CORE::init()->get_modules();
     if ($REQUEST->get('c') == '') {
         if ($USER->auth()) {
             if ($USER->get('gid') == 1) {
                 \CORE\UI::init()->static_page('admin', true);
             } else {
                 \CORE\UI::init()->static_page('user', true);
             }
         } else {
             \CORE\UI::init()->static_page('home');
         }
     } else {
         if (isset($modules[$REQUEST->get('c')])) {
             // \CORE::msg('debug','Controller: '.$REQUEST->get('c'));
             $model = null;
             $view = null;
             $controller = null;
             $p2 = strtoupper($REQUEST->get('c'));
             $path = array('m' => '', 'v' => '', 'c' => '');
             if ($modules[$REQUEST->get('c')] == 0) {
                 $p1 = 'CORE\\MVC\\';
                 $path['m'] = $p1 . 'M\\' . $p2 . '_M';
                 $path['v'] = $p1 . 'V\\' . $p2 . '_V';
                 $path['c'] = $p1 . 'C\\' . $p2 . '_C';
             } else {
                 $p1 = 'APP\\MVC\\';
                 $path['m'] = $p1 . 'M\\' . $p2 . '_M';
                 $path['v'] = $p1 . 'V\\' . $p2 . '_V';
                 $path['c'] = $p1 . 'C\\' . $p2 . '_C';
             }
             if (class_exists($path['c'])) {
                 if (\SEC::init()->acl($REQUEST->get('c'), $REQUEST->get('act'))) {
                     // access control ($USER)
                     if (class_exists($path['m'])) {
                         $model = new $path['m']();
                     }
                     if (class_exists($path['v'])) {
                         $view = new $path['v']();
                     }
                     $controller = new $path['c']($REQUEST, $model, $view);
                 }
             } else {
                 \CORE::msg('error', 'Module not loaded');
             }
         } else {
             \CORE::msg('error', 'Unregistered module');
             if ($USER->auth()) {
                 if ($USER->get('gid') == 1) {
                     \CORE\UI::init()->static_page('admin', true);
                 } else {
                     \CORE\UI::init()->static_page('user', true);
                 }
             } else {
                 \CORE\UI::init()->static_page('home');
             }
         }
     }
 }