public function main() { ?> <div id="main"> <div id="reports-new"> <div class="ui error form segment square-corners no-shadow"> <div class="three fields"> <div class="field"> <label>Год набора</label> <input id="year" name="year" placeholder="<?php echo date::year(); ?> " type="text" value="<?php echo $this->report->year; ?> "> </div> <div class="field"> <label>Срок обучения (лет)</label> <input id="duration" name="duration" placeholder="4" type="text" value="<?php echo $this->report->duration; ?> " onchange="calendar.update();"> </div> <div class="field"> <label>ФИО ректора</label> <input id="rector" name="rector" placeholder="М.П. Батура" type="text" value="<?php echo $this->report->rector; ?> "> </div> </div> <div class="field"> <label>Регистрационный номер учебного плана</label> <input id="registration_number" name="registration_number" placeholder="2014.09.20/000" type="text" value="<?php echo $this->report->registration_number; ?> "> </div> <div class="field"> <div class="ui fluid selection dropdown"> <div class="default text">Форма обучения</div> <i class="dropdown icon"></i> <input type="hidden" id="training_form_id" name="training_form_id" value="<?php echo $this->report->training_form_id; ?> "> <div class="menu"> <?php $training_forms = training_forms::get(); if ($training_forms) { foreach ($training_forms as $training_form) { ?> <div class="item" data-value="<?php echo $training_form->id; ?> "><?php echo html::escape($training_form->name); ?> </div> <?php } } ?> </div> </div> </div> <div class="field"> <div class="ui fluid selection dropdown"> <div class="default text">Квалификация специалиста</div> <i class="dropdown icon"></i> <input type="hidden" id="qualification_id" name="qualification_id" value="<?php echo $this->report->qualification_id; ?> "> <div class="menu"> <?php $qualifications = qualifications::get(); if ($qualifications) { foreach ($qualifications as $qualification) { ?> <div class="item" data-value="<?php echo $qualification->id; ?> "><?php echo html::escape($qualification->name); ?> </div> <?php } } ?> </div> </div> </div> <div class="field"> <div class="ui fluid selection dropdown"> <div class="default text">Специальность</div> <i class="dropdown icon"></i> <input type="hidden" id="specialty_id" name="specialty_id" value="<?php echo $this->report->specialty_id; ?> "> <div class="menu"> <?php $specialties = specialties::get(); if ($specialties) { foreach ($specialties as $specialty) { ?> <div class="item" data-value="<?php echo $specialty->id; ?> "><?php echo html::escape($specialty->name); ?> </div> <?php } } ?> </div> </div> </div> <div class="field"> <div class="ui fluid selection dropdown"> <div class="default text">Специализация</div> <i class="dropdown icon"></i> <input type="hidden" id="specialization_id" name="specialization_id" value="<?php echo $this->report->specialization_id; ?> "> <div class="menu"> <?php $specializations = specializations::get(); if ($specializations) { foreach ($specializations as $specialization) { ?> <div class="item" data-value="<?php echo $specialization->id; ?> "><?php echo html::escape($specialization->name); ?> </div> <?php } } ?> </div> </div> </div> <div class="field width50"> <label>Учебная практика</label> <textarea id="study_practice" name="study_practice"><?php echo $this->report->study_practice; ?> </textarea> </div> <div class="field width50"> <label>Производственная практика</label> <textarea id="manufact_practice" name="manufact_practice"><?php echo $this->report->manufact_practice; ?> </textarea> </div> <div class="field width50"> <label>Дипломные проекты или дипломные работы</label> <input id="grad_work" name="grad_work" type="text" value="<?php echo $this->report->grad_work; ?> "> </div> <div class="field width50"> <label>Государственный экзамен</label> <input id="gos_exam" name="gos_exam" type="text" value="<?php echo $this->report->gos_exam; ?> "> </div> <div id="education-list"> <div class="ui form"> </div> <ul id="education-ul"> <?php $educations = education::get_by_report(get('report_id')); ?> <?php foreach ($educations as $education) { ?> <li class="disciplines" data-id="<?php echo $education->id; ?> "> <div class="actions"> <div class="ui button red tiny" onclick=" remove_education(this,<?php echo $education->id; ?> );buttons.update();">Удалить</div> <div class="ui button blue tiny" onclick="education.filler.popup(education.filler.get(this),education.filler.getdata(this),education.filler.getid(this),<?php echo get('report_id'); ?> ,<?php echo $education->id; ?> );">Заполнить</div> </div> <div class="base" onclick="$(this).parent('li').find('.tip').toggle('slow'); $(this).find('i.icon.triangle').toggleClass('down').toggleClass('right')"> <i class="icon triangle down"></i> <span class="description"><?php echo $education->name; ?> </span> </div> <div class="tip"> <ul> <?php $educations_items = education_items::get_by_order($education->id); ?> <?php foreach ($educations_items as $item) { $values = education_items_values::get_by_education_item_id($item->id); ?> <li data-order="<?php echo $item->order_num; ?> " data-type="undefined" data-name="<?php echo $item->name; ?> " data-id="<?php echo $item->id; ?> " data-values="<?php for ($i = 1; $i < 40; $i++) { foreach ($values as $value) { if ($value->col_num == $i) { echo $value->value; } } echo ','; } ?> " draggable="true"><?php mb_strlen($item->name) > 96 ? $tmp = mb_substr($item->name, 0, 96, 'utf-8') . '...' : ($tmp = $item->name); echo $tmp; ?> <i class="icon remove circle" style="float: right" onclick="delete_item_discipline(this,<?php echo $item->id; ?> )" title="Удалить"></i> <i class="icon angle up" onclick="education.tip.move.up(this);"></i> <i class="icon angle down" onclick="education.tip.move.down(this);"></i> <div class="ui checkbox" style="float: right" data-content="Дисциплина по выбору"> <input type="checkbox" class="popup" <?php if ($item->is_optional == '1') { echo "checked='checked'"; } ?> > <label></label> </div> </li> <?php } ?> </ul> <div class="ui search selection dropdown" onclick=""> <input type="hidden" name="selected"> <div class="default text" onclick="$(this).html('')" onkeyup="education.hint.init(this)" contenteditable="true">Выберите наименование</div> <i class="dropdown icon"></i> <div class="menu"> <?php $disciplines = disciplines::get(); foreach ($disciplines as $discipline) { ?> <div class="item" data-type="discipline" data-name="<?php echo $discipline->name; ?> " data-id="<?php echo $discipline->id; ?> "><?php echo $discipline->name; ?> </div> <?php } ?> <?php $directions = directions::get(); foreach ($directions as $direction) { ?> <div class="item" data-type="direction" data-name="<?php echo $direction->name; ?> " data-id="<?php echo $direction->id; ?> "><?php echo $direction->name; ?> </div> <?php } ?> </div> </div> <div class="item ui button green" onclick="add_education_item(<?php echo $education->id; ?> ,this)">добавить</div> </div> </li> <?php } ?> </ul> </div> <script> $('.ui.checkbox').popup({ on: 'hover' }); function add_education_item(education_id,selector){ if ($(selector).parent('div').find('.text').hasClass('default')) { alert('Выберите название предмета из выпадающего списка.'); return; } var order = $(".tip li").length+1; var name = $(selector).closest('.tip').find('.item.active').attr('data-name'); var report_id = <?php echo get('report_id'); ?> ; $.post('/?page=reports-edit&task=add_education_item&report_id='+report_id+'&name='+name+'&education_id='+education_id+'&order='+order+'&ajax=true') .done(function(id) { education.tip.add(selector,id)}); } function delete_item_discipline(selector,id){ var report_id = <?php echo get('report_id'); ?> ; $.post('/?page=reports-edit&task=delete_item_discipline&report_id='+report_id+'&id='+id+'&ajax=true') .done(function() { $(selector).parent().remove();}); } function remove_education(selector,id){ var report_id = <?php echo get('report_id'); ?> ; $.post('/?page=reports-edit&task=remove_education&report_id='+report_id+'&id='+id+'&ajax=true') .done(function() { $(selector).closest('li').fadeToggle('slow', function() { $(selector).closest('li').remove(); } )}); } <?php $disciplines = disciplines::get(); $directions = directions::get(); $database = null; if ($disciplines) { foreach ($disciplines as $discipline) { $database .= '["discipline", "' . html::escape($discipline->name) . '", ' . $discipline->id . '],'; } $database = char::remove_last($database); } if ($directions) { if ($database) { $database .= ','; } foreach ($directions as $direction) { $database .= '["direction", "' . $direction->name . '", ' . $direction->id . '],'; } $database = char::remove_last($database); } ?> var database = [<?php echo $database; ?> ]; $(function() { education.disciplines.set(database); }); </script> <?php // $calendar = new ajax_calendar(); // $calendar->html(); ?> <div class="ui green submit button small" onclick="update();">Сохранить</div> <a href="#" target="_blank" id="button-preview" class="ui blue submit button small" onclick="save(1); return false;">Предпросмотр</a> <a href="#" target="_blank" id="button-popup" class="ui blue submit button small" onclick="calendar.popup(); return false;">Календарь</a> <a href="#" target="_blank" id="button-education" class="ui blue submit button small" onclick="$('#education').modal('show'); return false;">Добавить цикл</a> <div id="education" class="ui modal large"> <div class="ui form segment"> <div class="field"> <label>Наименование цикла</label> <input class="education-new" type="text" placeholder="Цикл социально-гуманитарных дисциплин"> </div> <a href="#" class="ui blue submit button small" onclick=" var name = $('.education-new').val(); $('.education-new').val(''); var report_id = <?php echo get('report_id'); ?> ; $.post('/?page=reports-edit&task=add_education&report_id='+report_id+'&name='+name+'&ajax=true') .done(function(data) { $('#education').modal('hide'); education.add(name,data,report_id); /*rude.redirect('/?page=reports-edit&report_id='+report_id);*/ }); return false; ">Добавить</a> </div> </div> <?php static::filler(); ?> <?php static::calendar(); ?> </div> </div> </div> <?php }
public static function last_day_of_week($year = null, $month = null, $week = null, $format = 'j') { if ($year === null) { $year = date::year(); } if ($month === null) { $month = date::month(); } if ($week === null) { $week = date::week(); } if ($week == date::weeks_in_month($year, $month)) { return date::last_day_of_month($year, $month, $format); } if ($week > date::weeks_in_month($year, $month)) { return 0; } return date($format, strtotime('this sunday', date::first_day_of_week($year, $month, $week, 'U'))); }