function approve($id, $data = null) { $training = new Training(); $course_obj = new Course(); $request = $this->get(array('id' => $id)); $course = $course_obj->get(array('id' => $request['course_id'])); $data['course_id'] = $request['course_id']; $data['start'] = $request['planned_date']; $date = new DateTime($data['start']); if ($course['duration'] > 8) { $date->add(new DateInterval('P' . ceil($course['duration'] / 8) . 'DT' . $course['duration'] % 8 . 'H')); } else { $date->add(new DateInterval('PT' . $course['duration'] . 'H')); } $data['finish'] = $date->format('Y-m-d H:i'); $data['user_id'] = $request['user_id']; $data['status_id'] = Training::CREATED; if ($course['format_id'] == Course::ONLINE || $course['format_id'] == Course::WEBCAST) { $data['course_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start']); } $data['tries'] = 0; if ($course['exam'] == 't') { $data['exam_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start'] . $data['tries']); } $data['request_id'] = $id; $data['active'] = 'true'; $training->add($data); $this->disable($id); }
public function actionAdmin() { $model = new Training('search'); $model->unsetAttributes(); if (isset($_GET['Training'])) { $model->setAttributes($_GET['Training']); } $this->render('admin', array('model' => $model)); }
public static function isReferenced($id) { require_once 'Training.php'; $training = new Training(); $select = $training->select(); $select->where("training_location_id = ?", $id); $select->where("is_deleted = 0"); if ($training->fetchRow($select)) { return true; } return false; }
function invert($id) { $db = new DB(); $db->select("SELECT * FROM {$this->tablename} WHERE id=\$1", array($id)); if ($db->valid()) { $data = $db->current(); $data['active'] = $data['active'] == 't' ? 'f' : 't'; $this->update($id, array('active' => $data['active'])); $training = new Training(); $training->updateMore(array('plan_id' => $id), array('active' => $data['active'])); } }
public function checkTitle($title) { $rs = Training::where('title', '=', $title)->count(); if (isset($rs)) { return $rs >= 1 ? false : true; } }
function displayBody() { parent::displayBody(); $translator = new Translator(); $course = new Course(); $training = new Training(); $t_data = $training->get(array('course_hash' => $this->course_hash, 'user_id' => $_SESSION['user_id'])); $c_data = $course->get(array('id' => $t_data['course_id'])); foreach ($c_data as $key => $val) { $c_data[$key] = htmlspecialchars($val, ENT_QUOTES); } echo <<<EOF <div class="container-fluid"> <div class="col-lg-10 col-lg-offset-1" id="window"> \t<div class="row" > \t<div class="col-xs-10"> \t <h4>{$c_data[category_name]}</h4> \t <h2>{$c_data[name]}</h2> \t</div> \t<div class="col-xs-2 text-right" id="top_buttons"> \t <a href="#" id="fullscreen"><span class="glyphicon glyphicon-fullscreen"></span></a> \t <a href="#" id="inscreen" class="collapse"><span class="glyphicon glyphicon-remove"></span></a> \t</div> \t</div> \t<div class="embed-responsive embed-responsive-16by9" id="fullscreen_media"> \t <iframe class="embed-responsive-item" src="/learn/{$this->course_hash}/index.html" id="iframe"></iframe> \t</div> \t<nav id="bottom_buttons"> \t <ul class="pager"> \t <li class="previous"><a href="#" id="back"><span aria-hidden="true">←</span> {$translator->Back}</a></li> \t <li class="top"><a href="#" id="top">{$translator->Top}</a>| \t\t<a href="/mycourses/finish/{$t_data[id]}" onclick='return confirm("{$translator->AreYouSure}");'>{$translator->Finish}</a></li> \t <li class="next"><a href="#" id="next">{$translator->Next} <span aria-hidden="true">→</span></a></li> \t </ul> \t</nav> </div> </div> <!-- /container --> EOF; }
<?php $this->breadcrumbs = array('Lớp học' => array('admin'), 'Quản lý'); $this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('class-guitar-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Các lớp học</h1> <?php echo GxHtml::link(Yii::t('app', 'Tìm kiếm'), '#', array('class' => 'search-button')); ?> <div class="search-form"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'class-guitar-grid', 'dataProvider' => $model->search(), 'columns' => array('sku', 'title', array('name' => 'tid', 'value' => 'GxHtml::valueEx($data->t)', 'filter' => GxHtml::listDataEx(Training::model()->findAllAttributes(null, true))), array('name' => 'cid', 'value' => 'GxHtml::valueEx($data->c)', 'filter' => GxHtml::listDataEx(Center::model()->findAllAttributes(null, true))), array('name' => 'start_time', 'value' => 'date("d/m/Y",$data->start_time)'), array('name' => 'end_time', 'value' => 'date("d/m/Y",$data->end_time)'), array('class' => 'CButtonColumn'))));
$class = ''; } $sel = new selectlist($id, $any->anylist, 'Select Catagory', 'Catagory_ID', 'Catagory', $class, '', '1'); break; case 'geninfo': //machine list $gin = new Geninfo(); if (isset($_GET['cid'])) { $gin->setValue('catagoryid', $_GET['cid']); } $gin->createInfoList(); $sel = new selectlist('Gen_Info_ID', $gin->getInfoList(), 'Select Information', 'Info_ID', 'infd', '', '', '1'); break; case 'trainingplan': //machine list $tpi = new Training(); if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = 'Training_Plan_ID'; } if (isset($_GET['fut'])) { $tpi->setValue('futureplans', $_GET['fut']); } if (isset($_GET['desc'])) { $tpd = $_GET['desc']; } else { $tpd = 'Training Plan'; } $tpi->createPlanList(); $sel = new selectlist($id, $tpi->getPlanList(), $tpd, 'Training_Plan_ID', 'pldesc', '', '', '1');
function buildMenu() { include __DIR__ . '/menu.php'; $translator = new Translator(); echo <<<EOF <div class="container-fluid"> <div class="row"> <div id="dashboard" class="col-sm-3 col-md-2 sidebar"> <ul class="nav nav-sidebar"> EOF; include_once __DIR__ . '/../training.php'; $training = new Training(); $t_cnt = $training->getActiveCount($_SESSION['user_id']); foreach ($user_menu as $title => $url) { if ($t_cnt > 0 && $url == '/mycourses') { $badge = " <span class=\"badge\">{$t_cnt}</span>"; } else { $badge = ''; } echo "<li" . ($url == $_SERVER['REDIRECT_URL'] ? ' class="active"' : '') . "><a href=\"{$url}\">{$title}" . $badge . "</a></li>\n"; } echo <<<EOF </ul> EOF; if (($_SESSION['role_id'] & (User::SUPERUSER | User::ADMIN | User::ADMIN_RO)) > 0) { include_once __DIR__ . '/../request.php'; $request = new Request(); $r_cnt = $request->getCount(array('active' => 'true')); echo <<<EOF <ul class="nav nav-sidebar"> \t <li ><div>{$translator->Administration}</div></li> EOF; foreach ($admin_menu as $title => $url) { if ($r_cnt > 0 && $url == '/admin_requests') { $badge = " <span class=\"badge\">{$r_cnt}</span>"; } else { $badge = ''; } echo "<li" . ($url == $_SERVER['REDIRECT_URL'] ? ' class="active"' : '') . "><a href=\"{$url}\">{$title}" . $badge . "</a></li>\n"; } echo <<<EOF </ul> EOF; } if (($_SESSION['role_id'] & (User::SUPERUSER | User::EDITOR_RO | User::EDITOR | User::EDITOR_SIMPLE)) > 0) { echo <<<EOF <ul class="nav nav-sidebar"> \t <li ><div>{$translator->Editor}</div></li> \t\t EOF; foreach ($editor_menu as $title => $url) { $badge = ''; echo "<li" . ($url == $_SERVER['REDIRECT_URL'] ? ' class="active"' : '') . "><a href=\"{$url}\">{$title}" . $badge . "</a></li>\n"; } echo <<<EOF </ul> \t\t EOF; } echo <<<EOF </div> EOF; }
</div> <div class="row"> <?php echo $form->label($model, 'status'); ?> <?php echo $form->dropDownList($model, 'status', array('Ẩn', 'Hiện')); ?> </div> <div class="row"> <?php echo $form->label($model, 'tid'); ?> <?php echo $form->dropDownList($model, 'tid', GxHtml::listDataEx(Training::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', '--Chọn loại khóa học--'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'cid'); ?> <?php echo $form->dropDownList($model, 'cid', GxHtml::listDataEx(Center::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', '--Chọn trung tâm--'))); ?> </div> <!--<div class="row"> <?php /*echo $form->label($model, 'start_time'); */
echo $form->labelEx($model, 'teacher_id'); ?> <?php echo $form->dropDownList($model, 'teacher_id', GxHtml::listDataEx(Teacher::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'teacher_id'); ?> </div> <!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'tid'); ?> <?php echo $form->dropDownList($model, 'tid', GxHtml::listDataEx(Training::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'tid'); ?> </div> <!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'cid'); ?> <?php echo $form->dropDownList($model, 'cid', GxHtml::listDataEx(Center::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'cid');
function training_preview($employee_id = '', $report_name = '') { $employee = new Employee_m(); $employee->get_by_id($employee_id); $office = new Office_m(); $office->get_by_office_id($employee->office_id); $type_employment = $this->options->type_employment(); $a = Setting::getField('republic'); $b = Setting::getField('lgu_name'); $c = Setting::getField('lgu_office'); $d = Setting::getField('lgu_address'); // this is for heading republic $lgu_code = Setting::getField('lgu_code'); // Laguna Province if ($lgu_code == 'laguna_province') { $logo = 'dtr/template/laguna_province/logo.jpg'; } $html = ' <table width="100%" border="0" cellpadding="5"> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $a . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $b . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $c . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $d . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"> </td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"> </td> </tr> <tr> <td colspan="4" align="center" style="font-size:18px;">Employee Training Record</td> </tr> <tr> <td width="16%"> </td> <td width="35%"> </td> <td width="27%"> </td> <td width="22%"> </td> </tr> <tr> <td align="left"><strong>Name:</strong></td> <td>' . $employee->lname . ', ' . $employee->fname . ' ' . $employee->mname . '</td> <td> </td> <td> </td> </tr> <tr> <td align="left"><strong>Department:</strong></td> <td>' . $office->office_name . '</td> <td align="left"><strong>Sex:</strong></td> <td>' . $employee->sex . '</td> </tr> <tr> <td align="left"><strong>Position:</strong></td> <td>' . $employee->position . '</td> <td align="left"><strong>Employment Status:</strong></td> <td>' . $type_employment[$employee->permanent] . '</td> </tr> </table> <table width="100%" border="0"> <tr> <td colspan="3" align="center">' . $report_name . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tbody><tr> <td width="10%"><strong>Date From</strong></td> <td width="9%"><strong>Date to</strong></td> <td width="4%"><strong>Course Title</strong></td> <td width="10%"><strong>Duration</strong></td> <td width="13%"><strong>Conducted By</strong></td> </tr>'; $params = array('format' => 'Letter'); $this->load->library('mpdf', $params); // LOAD a stylesheet $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $this->mpdf->WriteHTML($html); // Training=========================================================== $t = new Training(); $t->order_by('date_from', 'DESC'); $rows = $t->get_by_employee_id($employee_id); foreach ($rows as $row) { $entry = ' <tr> <td>' . $row->date_from . '</td> <td>' . $row->date_to . '</td> <td>' . $row->name . '</td> <td>' . $row->number_hours . '</td> <td>' . $row->conducted_by . '</td> </tr>'; $this->mpdf->WriteHTML($entry); } $signatories = ' <tr> <td></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </tbody></table> '; // Signatories $training_prepared = Setting::getField('training_prepared'); $training_prepared_position = Setting::getField('training_prepared_position'); $training_certified = Setting::getField('training_certified'); $training_certified_position = Setting::getField('training_certified_position'); $signatories .= ' <table width="100%" border="0"> <tr> <td width="38%"> </td> <td width="23%"> </td> <td width="39%"> </td> </tr> <tr> <td align="center">PREPARED BY:</td> <td> </td> <td align="center">CERTIFIED CORRECT:</td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center">' . $training_prepared . '</td> <td> </td> <td align="center">' . $training_certified . '</td> </tr> <tr> <td align="center">' . $training_prepared_position . '</td> <td> </td> <td align="center">' . $training_certified_position . '</td> </tr> </table> '; $this->mpdf->WriteHTML($signatories); $this->mpdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'I'); }
function page3($employee_id) { $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); //print_r($personal_info); // initiate FPDI $pdf = new FPDI('P', 'mm', 'Legal'); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/pds/page3.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 1, 1, 210); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(8, 31); $org = new Organization(); $orgs = $org->get_by_employee_id($employee_id); $i = 1; foreach ($orgs as $org) { $pdf->SetX(8); $pdf->Write(0, $org->name); $pdf->SetFont('Arial', '', 8); $pdf->SetX(95); $pdf->Write(0, $org->inclusive_date_from); $pdf->SetX(117); $pdf->Write(0, $org->inclusive_date_from); $pdf->SetFont('Arial', '', 12); $pdf->SetX(138); $pdf->Write(0, $org->number_of_hours); $pdf->SetX(155); $pdf->Write(0, $org->position); $pdf->SetX(188); $pdf->Write(0, $org->license_release_date); $pdf->SetFont('Arial', '', 12); if ($i == 2 || $i == 6) { $pdf->Ln(8); } else { $pdf->Ln(7); } $i++; } // ther info $pdf->SetXY(8, 258); $i = new Other_info(); $infos = $i->get_by_employee_id($employee_id); $i = 1; foreach ($infos as $info) { $pdf->SetFont('Arial', '', 8); $pdf->SetX(8); $pdf->Write(0, $info->special_skills); $pdf->SetX(58); $pdf->Write(0, $info->recognition); $pdf->SetX(155); //$pdf->Write(0, $info->membership_organization); $pdf->Write(0, str_replace('…', '..', character_limiter($info->membership_organization, 25))); $pdf->SetX(138); $pdf->Write(0, $info->number_hours); $pdf->SetX(155); $pdf->Write(0, $info->conducted_by); $pdf->SetFont('Arial', '', 12); if ($i == 6 || $i == 10 || $i == 11 || $i == 16) { $pdf->Ln(8); } else { $pdf->Ln(7); } $i++; } //Training (we set this code below other info // because of long list of trainings // but this will be first in page $pdf->SetXY(8, 105); $t = new Training(); $t->order_by('date_from', 'DESC'); // Lets set the limit first // //$t->limit(18); $trainings = $t->get_by_employee_id($employee_id); $i = 1; foreach ($trainings as $training) { $pdf->SetFont('Arial', '', 8); $pdf->SetX(8); //$pdf->Write(0, $training->name); $pdf->Write(0, str_replace('…', '..', character_limiter($training->name, 50))); $pdf->SetX(95); $pdf->Write(0, $training->date_from); $pdf->SetX(117); $pdf->Write(0, $training->date_to); $pdf->SetX(138); $pdf->Write(0, $training->number_hours); $pdf->SetX(155); //$pdf->Write(0, $training->conducted_by); $pdf->Write(0, str_replace('…', '..', character_limiter($training->conducted_by, 25))); $pdf->SetFont('Arial', '', 12); if ($i == 6 || $i == 10 || $i == 11 || $i == 16) { $pdf->Ln(8); } else { $pdf->Ln(7); } if ($i == 18) { //break; $pdf->AddPage(); } $i++; } // Output $pdf->Output('dtr/template/pds/page3_' . $employee_id . '.pdf', 'F'); //header("location:".base_url()."resources/pdfs/archives/page3_".$employee_id.'.pdf'); $this->pds[] = 'dtr/template/pds/page3_' . $employee_id . '.pdf'; }
<?php $pagetitle = 'Controller Profile'; require_once 'includes/header.php'; try { $student = $t->getStudent(Input::get('id')); if ($user->isActive($student->cid)) { $hours = $user->atcHours($student->cid); } $t = new Training(); $avatar = $user->getAvatarURL(['email' => $student->email]); $bookings = $t->userBookings($student->cid); } catch (Exception $e) { echo $e->getMessage(); } ?> <div class="col-md-12"> <h3 class="text-center"><?php echo $student->first_name . ' ' . $student->last_name; ?> </h3><br> <div class="row"> <div class="col-md-8"> <div class="panel panel-warning"> <div class="panel-heading"> <h3 class="panel-title">Profile</h3> </div> <div class="panel-body"> <div class="col-md-12">
<?php $this->breadcrumbs = array(Training::label(2), Yii::t('app', 'Index')); $this->menu = array(array('label' => Yii::t('app', 'Create') . ' ' . Training::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Manage') . ' ' . Training::label(2), 'url' => array('admin'))); ?> <h1><?php echo GxHtml::encode(Training::label(2)); ?> </h1> <?php $this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
<?php require_once 'autoload.php'; $tp = new Training(); $_SESSION['LAST_ACTIVITY'] = time(); if (isset($_POST['plandesc'])) { //print_r($_POST); if (isset($_POST['plandesc'])) { $tp->setValue('plandesc', $_POST['plandesc']); } if (isset($_POST['trainer'])) { $tp->setValue('trainer', $_POST['trainer']); } if (isset($_POST['startdatedb'])) { $tp->setValue('startdatedb', $_POST['startdatedb']); } if (isset($_POST['enddatedb'])) { $tp->setValue('enddatedb', $_POST['enddatedb']); } if (isset($_POST['opid'])) { $tp->setValue('trainees', $_POST['opid']); } if (isset($_POST['Evaluater_ID'])) { $tp->setValue('evaluaterid', $_POST['Evaluater_ID']); } if (isset($_POST['queid'])) { $tp->setValue('questionid', implode(',', $_POST['queid'])); } if (isset($_POST['Training_Plan_ID'])) { $tp->setValue('planid', $_POST['Training_Plan_ID']); $tpid = $_POST['Training_Plan_ID'];
<?php $pagetitle = "Admin Home"; require_once "includes/header.php"; $a = new Admin(); $t = new Training(); $incoming = $a->incoming(); ?> <div class="row"> <h3 class="text-center">Admin Dashboard</h3><br> <div class="col-md-6"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">Pending Incoming Students</h3> </div> <div class="panel-body" style="padding:0px;"> <?php if ($incoming) { ?> <table class="table table-responsive table-striped table-condensed"> <tr> <td><strong>Name</strong></td> <td><strong>Type</strong></td> <td><strong>CID</strong></td> <td><strong>Rating</strong></td> <td><strong>Pilot Rating</strong></td> <td><strong>Registered</strong></td> <td><strong>Options</strong></td> </tr> <?php
/** * Update person score in training */ public static function updateScore($ptt_id, $label, $value) { if (!is_numeric($ptt_id)) { return false; } $scoreTable = new Training(array('name' => 'score')); $select = $scoreTable->select()->from('score')->setIntegrityCheck(false); $select->where("person_to_training_id = {$ptt_id} AND score_label = ?", $label); $row = $scoreTable->fetchAll($select)->toArray(); // update if ($row) { $scoreTable->update(array('score_value' => $value), $scoreTable->getAdapter()->quoteInto("person_to_training_id = {$ptt_id} AND score_label = ?", $label)); } else { $scoreTable->insert(array('person_to_training_id' => $ptt_id, 'score_label' => $label, 'score_value' => $value)); } }
<?php $pagetitle = "Incoming Student"; require_once "includes/header.php"; $a = new Admin(); $t = new Training(); if (Input::exists('post')) { try { if (Input::get('reject')) { $delete = $user->delete([['id', '=', Input::get('id')], ['vateir_status', '<>', 1], ['vateir_status', '<>', 2]]); if ($delete) { Session::flash('success', 'Application approved'); Redirect::to('./'); } } elseif (Input::get('approve')) { if (Input::get('vateir_status') == 3) { $test = $user->update(['controllers.vateir_status' => '2', 'controllers.grou' => '10'], [['controllers.id', '=', Input::get('id')]]); if (!$t->findStudent(Input::get('id'))) { if ($controller->rating > 7) { $rating = $user->getRealRating(Input::get('id')); } else { $rating = $controller->rating; } $program = $t->program($rating); $studentMake = $t->createStudent(array('cid' => Input::get('id'), 'program' => $program)); } Session::flash('success', 'Application approved'); Redirect::to('./'); } } } catch (Exception $e) {
function displayBody() { parent::displayBody(); $translator = new Translator(); $course = new Course(); $training = new Training(); $id = array_shift($this->param); try { $t_exists = $training->checkFinish($_SESSION['user_id'], $id); } catch (Exception $e) { } $data = $course->get(array('id' => $id)); foreach ($data as $key => $val) { $data[$key] = htmlspecialchars($val, ENT_QUOTES); } foreach ($course->formats as $key => $val) { if ($key == $data['format_id']) { $format = htmlspecialchars($val, ENT_QUOTES); } } foreach ($course->languages as $key => $val) { if ($key == $data['language']) { $language = htmlspecialchars($val, ENT_QUOTES); } } if ($data['active'] == 't') { $active = 'checked'; } if ($data['exam'] == 't') { $exam = 'checked'; } if ($data[duration] > 8) { $duration = floor($data['duration'] / 8) . " {$translator->days}" . ($data['duration'] % 8 > 0 ? " + " . $data['duration'] % 8 . " {$translator->hours}" : ''); } else { $duration = $data['duration'] . " {$translator->hours}"; } if ($t_exists) { $disabled = 'disabled'; } echo <<<EOF <div class="container-fluid"> <div class="col-md-10 col-lg-8 col-lg-offset-2 "> \t<h4>{$data[category_name]}</h4> \t<h2>{$data[name]}</h2> \t<div class="row"> \t <div class="col-sm-6"><small>{$translator->Duration}: {$duration}</small></div> \t <div class="col-sm-6 text-right"><small>{$translator->Format}: {$format}</small></div> \t</div> \t<hr/> \t<label for="describe">{$translator->Describe}:</label> \t<p class="describe">{$data[describe]}</p> \t<label for="data">{$translator->Prerequisites}:</label> \t<p class="describe">{$data[prerequisites]}</p> \t<label for="skills">{$translator->Skills}:</label> \t<p class="describe">{$data[skills]}</p> \t<label for="equipment">{$translator->Equipment}:</label> \t<p class="describe">{$data[equipment]}</p> <!-- TODO> Add needed courses select-box \t <div class="form-group">Courses</div> <!--> \t<div> \t <label for="language">{$translator->Language}:</label> {$language} \t</div> \t<div> \t <label for="language">{$translator->Author}:</label> {$data[author]} \t</div> \t<hr/> \t<div> \t\t<a href="/enroll/{$data['id']}" class="btn btn-primary btn-lg {$disabled}" >{$translator->Register}</a> \t</div> \t</div> </div> <!-- /container --> EOF; }
public function trainingsAction() { try { require_once 'models/table/Training.php'; $table = new Training(); $select = $table->select()->from('training', array('*'))->setIntegrityCheck(false)->joinLeft(array('t' => 'training_title_option'), "training_title_option_id = t.id", array('training_title' => 'training_title_phrase'))->joinLeft(array('tl' => 'training_location'), "training.training_location_id = tl.id", array('training_location_name', 'location_id' => 'tl.location_id'))->joinLeft(array('tg' => 'training_got_curriculum_option'), "training.training_got_curriculum_option_id = tg.id", 'training_got_curriculum_phrase')->joinLeft(array('tlvl' => 'training_level_option'), "training.training_level_option_id = tlvl.id", 'training_level_phrase'); // todo inner joins were Causing trainings w/out level / title to not get dl'ed, might not print right w/out title, should replace nulls with 'unknown' or something $ids = $this->getSanParam('ids'); if ($ids) { $select = $select->where("training.id in ({$ids})"); $ids = explode(',', $ids); $this->view->assign('ids', $ids); } // fetch $rowRay = $table->fetchAll($select)->toArray(); //sort by id $sorted = array(); foreach ($rowRay as $row) { $sorted[$row['id']] = $row; } $sorted = $table->_fill_related($sorted, 'training_got_curriculum_option', 'training_got_curriculum_option_id', 'training_got_curriculum_phrase'); $locations = Location::getAll(); foreach ($sorted as $id => $row) { $city_info = Location::getCityInfo($row['location_id'], $this->setting('num_location_tiers'), $locations); if (count($city_info)) { $sorted[$id]['city_name'] = $locations[$city_info['city_name']]['location_name']; $sorted[$id]['province_name'] = $locations[$city_info[1]]['name']; if ($this->setting('display_region_b')) { $sorted[$id]['district_name'] = $locations[$city_info[2]]['name']; } if ($this->setting('display_region_c')) { $sorted[$id]['region_c_name'] = $locations[$city_info[3]]['name']; } if ($this->setting('display_region_d')) { $sorted[$id]['region_d_name'] = $locations[$city_info[4]]['name']; } if ($this->setting('display_region_e')) { $sorted[$id]['region_e_name'] = $locations[$city_info[5]]['name']; } if ($this->setting('display_region_f')) { $sorted[$id]['region_f_name'] = $locations[$city_info[6]]['name']; } if ($this->setting('display_region_g')) { $sorted[$id]['region_g_name'] = $locations[$city_info[7]]['name']; } if ($this->setting('display_region_h')) { $sorted[$id]['region_h_name'] = $locations[$city_info[8]]['name']; } if ($this->setting('display_region_i')) { $sorted[$id]['region_i_name'] = $locations[$city_info[9]]['name']; } } unset($sorted[$id]['location_id']); } #todo refresher option $sorted = $table->_fill_related($sorted, 'training_custom_1_option', 'training_custom_1_option_id', 'custom1_phrase'); $sorted = $table->_fill_related($sorted, 'training_custom_2_option', 'training_custom_2_option_id', 'custom2_phrase'); $sorted = $table->_fill_related($sorted, 'training_organizer_option', 'training_organizer_option_id', 'training_organizer_phrase'); $sorted = $table->_fill_related($sorted, 'training_level_option', 'training_level_option_id', 'training_level_phrase'); $sorted = $table->_fill_related($sorted, 'training_method_option', 'training_method_option_id', 'training_method_phrase'); $sorted = $table->_fill_related($sorted, 'trainer_language_option', 'training_primary_language_option_id', 'language_phrase'); $sorted = $table->_fill_related($sorted, 'trainer_language_option', 'training_secondary_language_option_id', 'language_phrase'); $sorted = $table->_fill_intersection_related($sorted, 'training_funding_option', 'training_to_training_funding_option', 'training_funding_option_id', 'funding_phrase'); $sorted = $table->_fill_intersection_related($sorted, 'training_pepfar_categories_option', 'training_to_training_pepfar_categories_option', 'training_pepfar_categories_option_id', 'pepfar_category_phrase'); $sorted = $table->_fill_intersection_related($sorted, 'training_topic_option', 'training_to_training_topic_option', 'training_topic_option_id', 'training_topic_phrase'); if ($this->setting('multi_opt_refresher_course')) { $sorted = $table->_fill_intersection_related($sorted, 'training_refresher_option', 'training_to_training_refresher_option', 'training_refresher_option_id', 'refresher_phrase_option'); } //fill participants require_once 'models/table/Person.php'; $personTable = new Person(); $select = $personTable->select()->from('person', array('id', 'first_name', 'middle_name', 'last_name'))->setIntegrityCheck(false)->join(array('pt' => 'person_to_training'), "pt.person_id = person.id", array('training_id')); $rows = $table->fetchAll($select); foreach ($rows as $row) { $tid = $row->training_id; if ($ids && array_search($tid, $ids) === false) { continue; } // dont print this training, the user has filtered by the url param ('ids') $ra = $row->toArray(); unset($ra['training_id']); $sorted[$tid]['participants'][] = $ra; } //fill participants require_once 'models/table/OptionList.php'; $qualsTable = new OptionList(array('name' => 'training_to_person_qualification_option')); $select = $qualsTable->select()->from('training_to_person_qualification_option', array('training_id', 'person_count_na', 'person_count_male', 'person_count_female'))->setIntegrityCheck(false)->join(array('tq' => 'person_qualification_option'), "tq.id = training_to_person_qualification_option.person_qualification_option_id", array('qualification_phrase')); $rows = $qualsTable->fetchAll($select); foreach ($rows as $row) { $tid = $row->training_id; if ($ids && array_search($tid, $ids) === false) { continue; } // dont print this training, the user has filtered by the url param ('ids') $ra = $row->toArray(); $ra['person_count_na'] = $ra['person_count_na'] . '(na)'; $ra['person_count_male'] = $ra['person_count_male'] . '(male)'; $ra['person_count_female'] = $ra['person_count_female'] . '(female)'; unset($ra['training_id']); $sorted[$tid]['unknown participants'][] = $ra; } //fill trainers require_once 'models/table/TrainingToTrainer.php'; $personTable = new TrainingToTrainer(); $select = $personTable->select()->from('training_to_trainer', array('training_id'))->setIntegrityCheck(false)->join(array('p' => 'person'), "training_to_trainer.trainer_id = p.id", array('id', 'first_name', 'middle_name', 'last_name')); $rows = $table->fetchAll($select); foreach ($rows as $row) { $tid = $row->training_id; if ($ids && array_search($tid, $ids) === false) { continue; } // dont print this training, the user has filtered by the url param ('ids') $ra = $row->toArray(); unset($ra['training_id']); $sorted[$tid]['trainers'][] = $ra; } $this->view->assign('data', $sorted); if ($this->getSanParam('outputType') == 'csv') { $this->sendData($this->reportHeaders(false, $sorted)); } } catch (Exception $e) { echo $e->getMessage(); error_log($e->getMessage()); } }
public function indexAction() { if ($this->hasACL('edit_employee') && $this->setting('module_employee_enabled')) { if ($this->hasACL('in-service') == false && $this->hasACL('pre-service') == false) { $this->_redirect('employee'); exit; } } if (strstr($_SERVER['REQUEST_URI'], 'index/index') === false) { if ($this->hasACL('in_service')) { $this->_redirect('index/index'); exit; } elseif ($this->hasACL('pre_service')) { $this->_redirect('dash/dash'); exit; } $this->_redirect('index/index'); exit; } $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $sql = "SELECT q2.qualification_phrase, COUNT(q2.qualification_phrase) CNT FROM person p INNER JOIN person_qualification_option q1 ON p.primary_qualification_option_id = q1.id INNER JOIN person_qualification_option q2 ON q1.parent_id = q2.id WHERE p.is_deleted = 0 GROUP BY q2.qualification_phrase;"; $rowyArray1 = $db->fetchAll($sql); $sql = "SELECT q3.qualification_phrase, 0 CNT FROM person_qualification_option q3 WHERE q3.id NOT IN (SELECT q2.id CNT FROM person p INNER JOIN person_qualification_option q1 ON p.primary_qualification_option_id = q1.id INNER JOIN person_qualification_option q2 ON q1.parent_id = q2.id WHERE p.is_deleted = 0) AND q3.parent_id IS NULL;"; $rowyArray2 = $db->fetchAll($sql); $rowyArray = array_merge($rowyArray1, $rowyArray2); $this->viewAssignEscaped('rowy', $rowyArray); $sql = "SELECT p.comments FROM person p INNER JOIN person_qualification_option q1 ON p.primary_qualification_option_id = q1.id INNER JOIN person_qualification_option q2 ON q1.parent_id = q2.id WHERE p.is_deleted = 0 AND q2.id = 8"; $rowsArray = $db->fetchAll($sql); $NIMART = 0; foreach ($rowsArray as $key => $row) { $NIMARTsplit = split("§", $rowsArray[$key]['comments']); if (strlen($NIMARTsplit[21]) > 0) { if ($NIMARTsplit[21] = "Nurse Initiating ART") { $NIMART = $NIMART + 1; } } } $this->viewAssignEscaped('NIMART', $NIMART); // retrieve list of incomplete courses created by user if ($this->hasACL('edit_course')) { require_once 'models/table/Training.php'; require_once 'models/Session.php'; require_once 'views/helpers/EditTableHelper.php'; require_once 'views/helpers/TrainingViewHelper.php'; $uid = Session::getCurrentUserId(); // Find incomplete training and future trainings $trainingFields = array('training_title' => t('Course Name'), 'training_start_date' => t('Start Date'), 'training_location_name' => t('Training Center'), 'creator' => t('Created By')); foreach (array_keys($trainingFields) as $key) { $colCustom[$key] = 'sortable:true'; } $colStatic = array_keys($trainingFields); // all $editLinkInfo['disabled'] = 1; $linkInfo = array('linkFields' => array_keys($trainingFields), 'linkId' => 'id', 'linkUrl' => Settings::$COUNTRY_BASE_URL . '/training/edit/id/%id%'); // restricted access?? only show trainings we have the ACL to view // add this to every query $org_allowed_ids = allowed_org_access_full_list($this); // doesnt have acl 'training_organizer_option_all' $allowedWhereClause = $org_allowed_ids ? " AND training_organizer_option_id in ({$org_allowed_ids}) " : ""; // restricted access?? only show organizers that belong to this site if its a multi org site $site_orgs = allowed_organizer_in_this_site($this); // for sites to host multiple training organizers on one domain $allowedWhereClause .= $site_orgs ? " AND training_organizer_option_id in ({$site_orgs}) " : ""; // Incomplete $tableObj = new Training(); $rowsPast = $tableObj->getIncompleteTraining($uid, 'training_start_date < NOW() ' . $allowedWhereClause)->toArray(); if ($rowsPast) { $html = EditTableHelper::generateHtmlTraining('TrainingPast', $rowsPast, $trainingFields, $colStatic, $linkInfo, $editLinkInfo, $colCustom); $this->view->assign('tableTrainingPast', $html); } // Future $tableObj = new Training(); $rowsFuture = $tableObj->getIncompleteTraining($uid, 'training_start_date >= NOW()' . $allowedWhereClause, '')->toArray(); if ($rowsFuture) { $html = EditTableHelper::generateHtmlTraining('TrainingFuture', $rowsFuture, $trainingFields, $colStatic, $linkInfo, $editLinkInfo, $colCustom); $this->view->assign('tableTrainingFuture', $html); } // Unapproved if ($this->setting('module_approvals_enabled')) { $tableObj = new Training(); $unapproved = $tableObj->getUnapprovedTraining("1" . $allowedWhereClause); // everything if ($unapproved) { $linkInfoUnapprov = $linkInfo; if (!$this->hasACL('approve_trainings')) { $linkInfoUnapprov['linkFields'] = array('training_title'); } $trainingFieldsUnapprov = $trainingFields; $trainingFieldsUnapprov['message'] = t('Message'); $colStatic['message'] = 'message'; $html = EditTableHelper::generateHtmlTraining('unapproved', $unapproved, $trainingFieldsUnapprov, $colStatic, $linkInfoUnapprov, $editLinkInfo, $colCustom); $this->view->assign('tableUnapproved', $html); } } //YTD, start at April 1 if ($ytdStart = $this->setting('fiscal_year_start')) { $ytdStart = date('Y-n-j', strtotime($ytdStart)); $this->view->assign('ytdStart', $ytdStart); //get total unique participants $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $sql = "SELECT COUNT(DISTINCT person_id) as \"unique_p\" from person_to_training left join training on (training.id = training_id and training.is_deleted = 0) where training_start_date > " . $ytdStart . $allowedWhereClause; $rowArray = $db->fetchRow($sql); $this->view->assign('unique_participants', $rowArray['unique_p']); } else { $ytdStart = date('Y') - (date('n') < 4 ? 1 : 0) . '-04-01'; $this->view->assign('ytdStart', $ytdStart); //get total unique participants $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $sql = "SELECT COUNT(DISTINCT person_id) as \"unique_p\" from person_to_training left join training on (training.id = training_id and training.is_deleted = 0) where 1 " . $allowedWhereClause; $rowArray = $db->fetchRow($sql); $this->view->assign('unique_participants', $rowArray['unique_p']); } $allowedOrgJoin = $allowedWhereClause ? ' LEFT JOIN training ON training.id = training_id WHERE training.is_deleted = 0 ' . $allowedWhereClause : ''; // only show trainings we're allowed to see by access level //get participants total and by YTD $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $sql = "SELECT COUNT(person_id) as \"attendees\" from person_to_training" . $allowedOrgJoin; $rowArray = $db->fetchRow($sql); $this->view->assign('attendees', $rowArray['attendees']); $sql = "SELECT COUNT(person_id) as \"attendees\" FROM training, person_to_training as pt WHERE pt.training_id = training.id AND training_start_date >= '{$ytdStart}'" . $allowedWhereClause; $rowArray = $db->fetchRow($sql); $this->view->assign('attendees_ytd', $rowArray['attendees']); //get total unique trainers if ($allowedOrgJoin) { $sql = "SELECT COUNT(DISTINCT trainer_id) as \"unique_t\" FROM training_to_trainer" . $allowedOrgJoin; // trainers in viewable trainings } else { $sql = "SELECT COUNT(person_id) as \"unique_t\" from trainer"; } $rowArray = $db->fetchRow($sql); $this->view->assign('unique_trainers', $rowArray['unique_t']); //get total trainers and by YTD $sql = "SELECT COUNT(trainer_id) as \"trainers\" FROM training_to_trainer" . $allowedOrgJoin; $rowArray = $db->fetchRow($sql); $this->view->assign('trainers', $rowArray['trainers']); $sql = "SELECT COUNT(tt.trainer_id) as \"trainers\" FROM training, training_to_trainer as tt WHERE tt.training_id = training.id AND training_start_date >= '{$ytdStart}'" . $allowedWhereClause; $rowArray = $db->fetchRow($sql); $this->view->assign('trainers_ytd', $rowArray['trainers']); //get trainings // total and YTD $sql = "SELECT COUNT(id) as \"trainings\", MIN(training_start_date) as \"min_date\",MAX(training_start_date) as \"max_date\" from training WHERE is_deleted = 0" . $allowedWhereClause; $rowArray = $db->fetchRow($sql); $this->view->assign('trainings', $rowArray['trainings']); $this->view->assign('min_date', $rowArray['min_date']); $this->view->assign('max_date', $rowArray['max_date']); $sql = "SELECT COUNT(id) as \"trainings\" from training WHERE training_start_date >= '{$ytdStart}' AND is_deleted = 0" . $allowedWhereClause; $rowArray = $db->fetchRow($sql); $this->view->assign('trainings_ytd', $rowArray['trainings']); } /****************************************************************************************************************/ /* Attached Files */ require_once 'views/helpers/FileUpload.php'; $PARENT_COMPONENT = 'home'; FileUpload::displayFiles($this, $PARENT_COMPONENT, 1, $this->hasACL('admin_files')); // File upload form if ($this->hasACL('admin_files')) { $this->view->assign('filesForm', FileUpload::displayUploadForm($PARENT_COMPONENT, 1, FileUpload::$FILETYPES)); } /****************************************************************************************************************/ }
public function actionRegister() { $arrayAuthRoleItems = Yii::app()->authManager->getAuthItems(2, Yii::app()->user->getId()); $arrayKeys = array_keys($arrayAuthRoleItems); $role = strtolower($arrayKeys[0]); if ($role == 'admin' || $role == 'teacher') { $this->redirect('/'); } $this->layout = 'dangkyhoc'; $model = new Student(); if (isset($_GET['cid']) && (int) $_GET['cid']) { $model->class_id = $_GET['cid']; } $db = Yii::app()->db; if (isset($_POST['Student']) && $_POST['Student']) { $model->setAttributes($_POST['Student']); $gclass = ClassGuitar::model()->findByPk($model->class_id); $sql = "SELECT * FROM {{student}} WHERE user_id =" . Yii::app()->user->id . " ORDER BY id DESC"; $cmd = $db->createCommand($sql); $student = $cmd->queryRow(); if ($student) { // var_dump($studentơclass_id); $gclass2 = ClassGuitar::model()->findByPk($student['class_id']); if ($student['status'] == 'comp') { //Hoàn thành if ($gclass->tid <= $gclass2->tid) { $training = Training::model()->findByPk($gclass2->tid); Yii::app()->user->setFlash('error', 'Bạn đã hoàn thành một lớp thuộc khóa <b>' . $training->title . '</b>. Vui lòng đăng ký khóa học cao hơn.'); } } elseif ($student['status'] == 'reg') { // Mới đăng ký Yii::app()->user->setFlash('error', 'Bạn đã đăng ký học tại lớp <b>' . $gclass2->title . '</b>. Vui lòng hủy đơn đăng ký này trước khi đăng ký tham gia lớp học khác!'); } else { $center = Center::model()->findByPk($gclass2->cid); Yii::app()->user->setFlash('error', 'Bạn đang tham gia lớp học <b>' . $gclass2->title . '</b> tại cơ sở <b>' . $center->title . '</b>!'); } } else { } if (!Yii::app()->user->hasFlash('error') && $model->save()) { if (Yii::app()->getRequest()->getIsAjaxRequest()) { Yii::app()->end(); } else { Yii::app()->user->setFlash('success', 'Bạn đã đăng ký lớp học thành công. LNT sẽ sớm liên lạc lại với bạn.'); } } } else { $oldStudent = Student::model()->find('user_id=' . Yii::app()->user->id); if ($oldStudent) { $model->name = $oldStudent->name; $model->email = $oldStudent->email; $model->tel = $oldStudent->tel; $model->birthday = $oldStudent->birthday; } } $this->render('register', array('model' => $model)); }
<?php require_once "../includes/header.php"; if (!$user->hasPermission('tdstaff')) { Session::flash('error', 'Invalid permissions'); Redirect::to(BASE_URL . 'training'); } ?> <h3 class="text-center">Sliders: Breakdown Options</h3><br> <div class="row"> <div class="col-md-12"> <?php $t = new Training(); $r = new Reports(); $programs = $t->getPrograms(); foreach ($programs as $program) { ?> <div class="row"> <div class="col-md-10 col-md-offset-1"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title"><?php echo $program->name; ?> </h3> </div> <div class="panel-body"> <table class="table table-striped table-condensed table-responsive"> <?php $sliders = $r->getSliders(1, $program->id); if ($sliders !== false) {
} AutoCenter(); </script> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-info"> <div class="panel-heading"> <h3 class="panel-title">ATC Bookings</h3> </div> <div class="panel-body"> <?php $t = new Training(); $bookings = $t->bookings(); if (count($bookings->atc) > 0) { echo '<table class="table table-striped table-responsive table-condensed"> <tr> <td><strong>Position</strong></td> <td><strong>Controller</strong></td> <td><strong>From (UTC)</strong></td> <td><strong>Until (UTC)</strong></td> </tr>'; foreach ($bookings->atc as $booking) { echo '<tr><td>'; echo $booking->callsign; echo '</td>'; echo '<td>'; echo $booking->name;
function employees($employee_id = '') { $data['page_name'] = '<b>Employee\'s Training Record</b>'; $data['focus_field'] = 'tra_name'; $data['msg'] = ''; $employee_id = Input::get('employee_id'); $e = new Employee_m(); $data['employee'] = $e->get_by_id(Input::get('employee_id')); $data['pics'] = file_exists('pics/' . $e->pics) ? $e->pics : 'not_available.jpg'; $image_properties = array('src' => base_url() . 'pics/' . $data['pics'], 'width' => '140', 'height' => '140'); $data['pics'] = $image_properties; $em = new Employee_movement_m(); $em->get_by_id($e->employee_movement_id); $data['employment_movement'] = $em->employee_movement; if (Input::get('op')) { // TRAINING PROGRAMS========================= $tra_name = Input::get('tra_name'); $tra_date_from = Input::get('tra_date_from'); $tra_date_to = Input::get('tra_date_to'); $tra_hours = Input::get('tra_hours'); $tra_conduct = Input::get('tra_conduct'); $tra_location = Input::get('tra_location'); $t = new Training(); $t->get_by_employee_id($employee_id); $t->delete_all(); $i = 0; foreach ($tra_name as $tra) { if ($tra != "") { $t = new Training(); $t->employee_id = $employee_id; $t->name = $tra_name[$i]; $t->date_from = $tra_date_from[$i]; $t->date_to = $tra_date_to[$i]; $t->number_hours = $tra_hours[$i]; $t->conducted_by = $tra_conduct[$i]; $t->location = $tra_location[$i]; $t->save(); } $i++; } $data['msg'] = 'Trainings has been saved!'; } // Recommended trainings if (Input::get('op2')) { $recommends = Input::get('recommend_id'); $reco_year = Input::get('reco_year'); $course_id = Input::get('course_id'); $relevant = Input::get('relevant'); $reco_remarks = Input::get('reco_remarks'); $i = 0; foreach ($recommends as $r_id) { if ($reco_year[$i] != '') { $t = new Training_recomended_m(); $t->where('course_id', $course_id[$i]); $t->where('reco_year', $reco_year[$i]); $t->where('employee_id', $employee_id); $t->get(); $t->employee_id = $employee_id; $t->reco_year = $reco_year[$i]; $t->course_id = $course_id[$i]; $t->relevant = $relevant[$i]; $t->reco_remarks = $reco_remarks[$i]; $t->save(); } $i++; } // Remove checked if (Input::get('remove')) { foreach (Input::get('remove') as $recommended_id) { $t = new Training_recomended_m(); $t->get_by_id($recommended_id); $t->delete(); } } } // Actual duties if (Input::get('op3')) { $duties_ids = Input::get('duties_id'); $duty_from = Input::get('duty_from'); $duty_to = Input::get('duty_to'); $duty_desc = Input::get('duty_desc'); $i = 0; foreach ($duties_ids as $r_id) { if ($duty_from[$i] != '') { $ed = new Employee_duty_m(); $ed->get_by_id($r_id); $ed->employee_id = $employee_id; $ed->duty_from = $duty_from[$i]; $ed->duty_to = $duty_to[$i]; $ed->duty_desc = $duty_desc[$i]; $ed->save(); } $i++; } } // Training=========================================================== $t = new Training(); $t->order_by('date_from', 'DESC'); $data['trains'] = $t->get_by_employee_id($employee_id); $data['tra_location_options'] = array('local' => 'Local', 'regional' => 'Regional', 'national' => 'National', 'international' => 'International'); if ($employee_id == '') { $data['trains'] = array(); } // Recommended Trainings $t = new Training_recomended_m(); $t->order_by('reco_year'); $data['recommends'] = $t->get_by_employee_id($employee_id); // Actual Duties $ed = new Employee_duty_m(); $ed->order_by('duty_from'); $data['duties'] = $ed->get_by_employee_id($employee_id); $data['selected'] = $e->office_id; //Use for office listbox $data['options'] = $this->options->office_options(); // Courses $t = new Training_course(); $data['courses'] = $t->courses(); $data['employee_id'] = $employee_id; $data['main_content'] = 'employees'; return View::make('includes/template', $data); }
function displayBody() { parent::displayBody(); $translator = new Translator(); $course = new Course(); $category = new Category(); $training = new Training(); $t_data = $training->get(array('id' => $this->id, 'user_id' => $_SESSION['user_id'])); $c_data = $course->get(array('id' => $t_data['course_id'])); foreach ($c_data as $key => $val) { $c_data[$key] = htmlspecialchars($val, ENT_QUOTES); } $category_id = $c_data['category_id']; $enum = $category->enumerate(); if ($enum) { foreach ($enum as $key => $val) { if ($val['id'] != 0) { $items[$val['id']] = $val; } } $categories = $this->makeCategoryList($items, $category_id); } if ($t_data['status_id'] == Training::FINISHED) { $result = $translator->Congratulations; $result_class = "alert-success"; } else { $result = $translator->Sorry; $result_class = "alert-danger"; } echo <<<EOF <div class="container-fluid"> <div class="col-lg-10 col-lg-offset-1" id="window"> \t<h4>{$categories}</h4> \t<h2>{$c_data[name]}</h2> \t<h3 class="alert {$result_class}" role="alert">{$result}</h3> \t<h4>{$translator->Result}: {$t_data[result]}% ({$t_data['answers']} / {$t_data[questions]})</h4> \t<table class="table"> \t <tr> \t\t<th>#</th> \t\t<th>{$translator->Question}</th> \t\t<th>{$translator->Result}</th> \t </tr> EOF; $exam = new Exam(); $enum = $exam->enumerateResult($t_data['id']); $i = 1; foreach ($enum as $key => $e_data) { $answer = $e_data['result'] == 't' ? $translator->Right : $translator->Wrong; $class = $e_data['result'] == 't' ? "success" : "danger"; echo <<<EOF \t <tr class="alert alert-{$class}" role="alert"> \t\t<td>{$i}</td> \t\t<td>{$e_data[question]}</td> \t\t<td >{$answer}</td> \t </tr> EOF; $i++; } echo <<<EOF \t</table> </div> </div> <!-- /container --> EOF; }
<?php $trainingClass = new Training(); $allSports = $trainingClass->getAllTrainingSport(); $newTraining = (include_once 'views/training_diary/new_training.php'); $actualWeek = (include_once 'views/training_diary/actual_week.php'); return include_once 'views/training_diary/diary_index-html.php';
function displayBody() { parent::displayBody(); $translator = new Translator(); $plan = new Plan(); $page = $_GET['page']; $offset = intval($page) * ITEMS_IN_PAGE; if (isset($_GET['search'])) { unset($_GET['search']); unset($_GET['page']); $search = $_GET; } else { $search = array('active' => 'true'); } $search['not_finish'] = 'true'; $cnt = $plan->getCount($search); if (sizeof($_GET) > 0) { foreach ($_GET as $key => $val) { $values[$key] = htmlspecialchars($val, ENT_QUOTES); } } $categories = Course::getCategoriesForSelect(0); if ($cnt > ITEMS_IN_PAGE) { $pagination = $this->addPaginator($cnt, $page); } echo <<<EOF <h2 class="page-header">{$translator->Plans_header} <span class="badge">{$cnt}</span></h2> <!-- disable filter temporary <div class="row"> \t<div class="btn-group"> \t<button class="btn btn-sm btn-default" data-toggle="collapse" data-target="#filter"> \t <span class="glyphicon glyphicon-filter"></span> {$translator->Filter} \t</button> \t</div> </div> <div class="row"> <div class="col-md-5 collapse" id="filter"> \t <form role="form" class="form-horizontal" action="?" method="get"> \t\t<div class="form-group"> \t\t <div class="form-group"> \t\t <label for="category" class="control-label col-sm-3">{$translator->Category}:</label> \t\t <div class="col-sm-8"> \t\t <select name="category_id" class="form-control" > \t\t\t{$categories} \t\t </select> \t\t </div> \t\t </div> \t\t <div class="form-group"> \t\t <label for="start" class="control-label col-sm-3">{$translator->Start}:</label> \t\t <div class="col-sm-8"> \t\t <input type="text" class="form-control datetimepicker" id="start" name="start" value="{$values[start]}"> \t\t </div> \t\t </div> \t\t <div class="form-group"> \t\t <label for="finish" class="control-label col-sm-3">{$translator->Finish}:</label> \t\t <div class="col-sm-8"> \t\t <input type="text" class="form-control datetimepicker" id="finish" name="finish" value="{$values[finish]}"> \t\t </div> \t\t </div> \t\t <div class="form-group"> \t\t <div class="col-sm-offset-3 col-md-10"> \t\t <input class="sr-only" name="search" value="1"> \t\t <button type="submit" class="btn btn-sm btn-default">{$translator->Apply}</button> \t\t </div> \t\t </div> \t\t</div> \t </form> \t</div> </div> --> EOF; $course = new Course(); $training = new Training(); $enum = $plan->enumerate($search, $offset, ITEMS_IN_PAGE); if (is_object($enum)) { echo <<<EOF {$pagination} <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>#</th> <th>{$translator->Course}</th> <th>{$translator->Start}</th> <th>{$translator->Finish}</th> <th>{$translator->Users}</th> </tr> </thead> <tbody> EOF; $i = 1 + $offset; foreach ($enum as $key => $data) { $c_data = $course->get(array('id' => $data['course_id'])); $participants = $training->getCount(array('plan_id' => $data['id'])); echo " <tr>\n <td>{$i}</td>\n <td>" . ($data['active'] == 'f' ? '<del>' : '') . "<p class=\"text-muted\">{$data[category_name]}</p>\n\t\t\t<a href=\"/course/{$c_data[id]}\">{$c_data[name]}</a></td>\n <td>{$data[start]}</td>\n <td>{$data[finish]}</td>\n <td>{$participants}</td>\n </tr>" . NL; $i++; } echo <<<EOF \t </table> \t</div> EOF; } else { echo $translator->No_trainings; } }
if ($data->rating->id > 7) { //get the CID's real rating (instead of SUP/ADM/INS etc) $rating = $user->getRealRating($data->id); } else { $rating = $data->rating->id; } $pilotRating = $t->pilotRating($data->pilot_rating->rating); $try = $user->create(['id' => $data->id, 'first_name' => $data->name_first, 'last_name' => $data->name_last, 'email' => $data->email, 'rating' => $rating, 'pilot_rating' => $data->pilot_rating->rating, 'pratingstring' => $pilotRating, 'regdate_vatsim' => date("Y-m-d H:i:s", strtotime($data->reg_date)), 'regdate_vateir' => date('Y-m-d H:i:s'), 'vateir_status' => 4]); Session::flash("success", "Thank you for your transfer request. A member of staff will be in touch!"); Redirect::to("../index.php"); } catch (Exception $e) { echo $e->getMessage(); } } elseif (isset($_POST["visiting"])) { //visiting request $t = new Training(); if ($data->rating->id > 7) { //get the CID's real rating (instead of SUP/ADM/INS etc) $rating = $user->getRealRating($data->id); } else { $rating = $data->rating->id; } $pilotRating = $t->pilotRating($data->pilot_rating->rating); try { $try = $user->create(['id' => $data->id, 'first_name' => $data->name_first, 'last_name' => $data->name_last, 'email' => $data->email, 'rating' => $rating, 'pilot_rating' => $data->pilot_rating->rating, 'pratingstring' => $pilotRating, 'regdate_vatsim' => date("Y-m-d H:i:s", strtotime($data->reg_date)), 'regdate_vateir' => date('Y-m-d H:i:s'), 'vateir_status' => 3]); Session::flash("success", "Thank you for your application. A member of staff will be in touch!"); Redirect::to("../index.php"); } catch (Exception $f) { echo $f->getMessage(); } }