本文整理汇总了PHP中Subjects类的典型用法代码示例。如果您正苦于以下问题:PHP Subjects类的具体用法?PHP Subjects怎么用?PHP Subjects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Subjects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show($metaPoziadavkaID)
{
$res = $this->requirements->load($metaPoziadavkaID);
$this->set("meta_poziadavka", $res["meta_poziadavka"]);
$this->set("requirement", $res["requirement"]);
// doplnujuce informacie, co, kto a kedy
$subjects = new Subjects();
$rooms = new Rooms();
//TODO nenatiahnut to do meta poziadavky rovno aj nazov predmetu ??
$id_predmet = $res["meta_poziadavka"]["id_predmet"];
$subject = $subjects->getSubject($id_predmet);
$student_count = $subjects->getStudentCount($id_predmet);
$student_count_info = $subjects->getStudentCountInfo($id_predmet);
$this->set("subject", $subject["nazov"]);
$this->set('student_count', $student_count['count']);
$this->set('student_count_info', $student_count_info);
$this->set('rooms', $rooms->getAll());
$this->set('metaPoziadavkaID', $metaPoziadavkaID);
$id_predmet = $res["meta_poziadavka"]["id_predmet"];
$id_poziadavka_typ = 1;
$previousMetaID = $this->requirements->getPreviousMetaID($id_predmet, $metaPoziadavkaID);
$nextMetaID = $this->requirements->getNextMetaID($id_predmet, $metaPoziadavkaID);
$this->set("previousMetaID", $previousMetaID);
$this->set("nextMetaID", $nextMetaID);
}
示例2: renderSubjects
public function renderSubjects($args = NULL)
{
dump($args);
if (key_exists('shire', $args)) {
$this->subjects->where('ad_shire', $args['shire']);
}
if (key_exists('locality', $args)) {
$this->subjects->where('ad_locality', $args['locality']);
}
if (key_exists('category', $args)) {
$this->subjects->where('ad_category', $args['category']);
}
$this->subjects->fetchAd($this->strict);
$this->template->setFile(dirname(__FILE__) . '/subjects.latte');
$this->render();
}
示例3: actionCreate
public function actionCreate()
{
$model = new Subjects('insert');
$users_list = CHtml::listData(Users::model()->findAll(), 'id', 'username');
if (Yii::app()->request->isPostRequest) {
$classroom = Yii::app()->request->getParam('Subjects');
$model->setAttributes($classroom);
if (!Yii::app()->user->checkAccess('admin')) {
$model->setAttribute('owner_id', Yii::app()->user->id);
}
if ($model->save()) {
Yii::app()->user->setFlash('success', 'Предмет успешно создан');
$this->redirect(['index']);
}
}
$this->render('form', ['model' => $model, 'users_list' => $users_list]);
}
示例4: __vyucujePredmet
/**
* Zisti ci dotycna osoba vyucuje dany predmet v danej roli
* @param int $pedagogID - id pedagoga
* @param int $predmetID - id rpedmetu
* @param String $rola - kod roli
* @param String $akcia - popis akcie tkoru chce vykonat nad predmetom (aktualne see alebo edit)
* @return boolean - true ak vyucuje predmet, inakk false
*/
private function __vyucujePredmet($pedagogID, $predmetID, $rola, $akcia)
{
$vyucuje = $this->courses->vyucujePredmet($pedagogID, $predmetID, $rola);
if (!$vyucuje) {
$subject = Subjects::getSubjectInfo($predmetID);
$this->controller->log("Pokus o akciu `{$akcia}` neprideleného predmetu `{$subject}` v roli `{$rola}`");
$this->controller->flash("Tento predmet vám nebol pridelený.", "error");
}
return $vyucuje;
}
示例5: codes
public function codes($attribute, $params)
{
$flag = 0;
$subject = Subjects::model()->findAllByAttributes(array('batch_id' => $this->batch_id, 'is_deleted' => 0));
foreach ($subject as $subject_1) {
if ($subject_1->name == $this->name) {
$flag = 1;
}
}
if ($flag == 1) {
$this->addError($attribute, 'This subject is already added');
}
}
示例6: edit
public function edit($id)
{
if (Auth::check() && (Auth::user()->id == $id || Auth::user()->access == 1)) {
$tutor = Tutor::firstOrCreate(['id' => $id]);
$subjects = Subjects::all();
$levels = Subjects::getLevels();
$districts = Districts::all();
$subject = Input::get('sublevel');
$district = Input::get('district');
return View::make('edit_profile')->with(compact(['tutors', 'subjects', 'levels', 'districts']));
}
return View::make('login');
}
示例7: actionDelete
public function actionDelete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = \Yii::$app->request;
$data = $request->post();
$id = $data['id'];
try {
Subjects::findOne(['id' => $id])->delete();
return ['status' => 1, 'message' => 'Thành công'];
} catch (Exception $ex) {
return ['status' => 0, 'message' => 'Có lỗi xảy ra'];
}
}
示例8: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Exams();
$model_1 = new ExamGroups();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Exams'])) {
//$model->attributes=$_POST['Exams'];
if (isset($_REQUEST['exam_group_id'])) {
$insert_id = $_REQUEST['exam_group_id'];
} else {
$model_1->attributes = $_POST['ExamGroups'];
$model_1->batch_id = $_REQUEST['id'];
$model_1->save();
$insert_id = Yii::app()->db->getLastInsertID();
}
$posts = Subjects::model()->findAll("batch_id=:x AND no_exams=:y", array(':x' => $_REQUEST['id'], ':y' => 0));
$list = $_POST['Exams'];
$count = count($list['subject_id']);
$j = 0;
for ($i = 0; $i < $count; $i++) {
if ($list['maximum_marks'][$i] != NULL and $list['minimum_marks'][$i] != NULL and $list['start_time'][$i] != NULL and $list['end_time'][$i] != NULL) {
$model = new Exams();
$model->exam_group_id = $insert_id;
$model->subject_id = $list['subject_id'][$i];
$model->maximum_marks = $list['maximum_marks'][$i];
$model->minimum_marks = $list['minimum_marks'][$i];
$model->start_time = $list['start_time'][$i];
$model->end_time = $list['end_time'][$i];
if ($model->start_time) {
$date1 = date('Y-m-d H:i', strtotime($model->start_time));
$model->start_time = $date1;
}
if ($model->end_time) {
$date2 = date('Y-m-d H:i', strtotime($model->end_time));
$model->end_time = $date2;
}
$model->grading_level_id = $list['grading_level_id'];
$model->weightage = $list['weightage'];
$model->event_id = $list['event_id'];
$model->created_at = $list['created_at'];
$model->updated_at = $list['updated_at'];
$model->save();
}
}
$this->redirect(array('exams/create', 'id' => $_REQUEST['id'], 'exam_group_id' => $_REQUEST['exam_group_id']));
}
$this->render('create', array('model' => $model, 'model_1' => $model_1));
}
示例9: show
function show($metaPoziadavkaID)
{
$res = $this->requirements->load($metaPoziadavkaID);
$this->set("meta_poziadavka", $res["meta_poziadavka"]);
$this->set("requirement", $res["requirement"]);
$subjects = new Subjects();
$rooms = new Rooms();
$id_predmet = $res["meta_poziadavka"]["id_predmet"];
$subject = $subjects->getSubject($id_predmet);
$student_count = $subjects->getStudentCount($id_predmet);
$student_count_info = $subjects->getStudentCountInfo($id_predmet);
$this->set("subject", $subject["nazov"]);
$this->set('student_count', $student_count['count']);
$this->set('student_count_info', $student_count_info);
$this->set('rooms', $rooms->getAll());
$this->set('types', $rooms->getTypes());
$this->set('metaPoziadavkaID', $metaPoziadavkaID);
$id_predmet = $res["meta_poziadavka"]["id_predmet"];
$id_poziadavka_typ = 2;
$previousMetaID = $this->requirements->getPreviousMetaID($id_predmet, $metaPoziadavkaID);
$nextMetaID = $this->requirements->getNextMetaID($id_predmet, $metaPoziadavkaID);
$this->set("previousMetaID", $previousMetaID);
$this->set("nextMetaID", $nextMetaID);
}
示例10: draw
function draw()
{
global $display;
$keyword = Url::get('keyword');
if (!$keyword) {
$keyword = Url::get('keyword_mobile');
}
$order_str = '';
$where_class = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" AND is_active = 1 ';
$where_subject = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" ';
$where_lesson = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" ';
$per_page = 21;
$list_class = Classes::get_collection(' LIMIT 0, ' . $per_page, $where_class, $order_str);
$list_subject = Subjects::get_collection(' LIMIT 0, ' . $per_page, $where_subject, $order_str);
$list_lesson = Lessons::get_collection(' LIMIT 0, ' . $per_page, $where_lesson, $order_str);
$current_url = strtok($_SERVER['REQUEST_URI'], '&');
if (count($list_class) == $per_page) {
$is_next_class = 1;
array_pop($list_class);
} else {
$is_next_class = 0;
}
if (count($list_subject) == $per_page) {
$is_next_subject = 1;
array_pop($list_subject);
} else {
$is_next_subject = 0;
}
if (count($list_lesson) == $per_page) {
$is_next_lesson = 1;
array_pop($list_lesson);
} else {
$is_next_lesson = 0;
}
$display->add('current_url', $current_url);
$display->add('is_next_class', $is_next_class);
$display->add('is_next_subject', $is_next_subject);
$display->add('is_next_lesson', $is_next_lesson);
$display->add('list_class', $list_class);
$display->add('list_subject', $list_subject);
$display->add('list_lesson', $list_lesson);
$display->add('keyword_view', htmlspecialchars($keyword));
$display->add('keyword', $keyword);
$display->add('keyword_mobile', $keyword);
// Output
$display->output("list");
}
示例11: save
/**
* Zabezpeci ulozenie poziadavky. Handluje aj pridanie aj upravu existujucej.
*/
function save()
{
try {
$crses = new Courses();
$minule = $crses->getMinulorocne($this->getSemesterID());
$this->set('minule', $minule);
$checked = $this->bind($this->requirements);
if (!$this->canEdit($this->requirements->id, "Garant", $this->redirect)) {
return;
}
$this->requirements->save();
$courseInfo = Subjects::getSubjectInfo($this->requirements->id);
//poslat notifikaciu
$this->notificator->sendCourseAssignedMsg($this->requirements);
$this->log("Vloženie/editácia garantovej požiadavky na predmet `{$courseInfo}`");
$this->flash('Požiadavky boli uložené.');
$this->redirect('garant/requirements/index');
} catch (dataValidationException $ex) {
$this->set('requirements', $ex->checked);
$this->__commonData($this->requirements->id);
}
}
示例12: DropDown
public static function DropDown($SepcialityID = 0, $Level = 0)
{
$res = array();
$c = new CDbCriteria();
$c->order = 'SubjectName';
//if ($SepcialityID == 0){
foreach (Subjects::model()->findAll($c) as $record) {
$res[$record->idSubjects] = $record->SubjectName;
}
// } else {
//
// $ssubj = Specialitysubjects::model()->find("SpecialityID=:SpecialityID and LevelID = :LevelID",
// array(":SpecialityID"=>$SepcialityID,":LevelID"=>$Level));
// if (!empty($ssubj->subject)){
// $res[$ssubj->subject->idSubjects] = $ssubj->subject->SubjectName;
// } else {
// foreach(Subjects::model()->findAll() as $record) {
// $res[$record->idSubjects] = $record->SubjectName;
// }
// }
// }
return $res;
}
示例13: array
<?php
for ($i = 0; $i < $count_timing; $i++) {
echo ' <td class="td">
<div onclick="" style="position: relative; ">
<div class="tt-subject">
<div class="subject">';
$set = TimetableEntries::model()->findByAttributes(array('batch_id' => $_REQUEST['id'], 'weekday_id' => $weekdays[6]['weekday'], 'class_timing_id' => $timing[$i]['id']));
if (count($set) == 0) {
$is_break = ClassTimings::model()->findByAttributes(array('id' => $timing[$i]['id'], 'is_break' => 1));
if ($is_break == NULL) {
echo CHtml::ajaxLink(Yii::t('weekdays', 'Assign'), $this->createUrl('TimetableEntries/settime'), array('onclick' => '$("#jobDialog' . $timing[$i]['id'] . $weekdays[6]['weekday'] . '").dialog("open"); return false;', 'update' => '#jobDialog' . $timing[$i]['id'] . $weekdays[6]['weekday'], 'type' => 'GET', 'data' => array('batch_id' => $_REQUEST['id'], 'weekday_id' => $weekdays[6]['weekday'], 'class_timing_id' => $timing[$i]['id']), 'dataType' => 'text'), array('id' => 'showJobDialog' . $timing[$i]['id'] . $weekdays[6]['weekday']));
} else {
echo Yii::t('weekdays', 'Break');
}
} else {
$time_sub = Subjects::model()->findByAttributes(array('id' => $set->subject_id));
if ($time_sub != NULL) {
echo $time_sub->name . '<br>';
}
$time_emp = Employees::model()->findByAttributes(array('id' => $set->employee_id));
if ($time_emp != NULL) {
echo '<div class="employee">' . $time_emp->first_name . '</div>';
}
echo CHtml::link('', array('timetableEntries/remove', 'id' => $set->id, 'batch_id' => $_REQUEST['id']), array('confirm' => 'Are you sure?', 'class' => 'delete'));
}
echo '</div>
</div>
</div>
<div id="jobDialog' . $timing[$i]['id'] . $weekdays[6]['weekday'] . '"></div>
</td>';
}
示例14: array
// 'Specialitysubjects'=>array('index'),
// 'Manage',
//);
$this->menu = array(array('label' => 'Перелік предметів напрямів', 'url' => array('admin'), 'icon' => "icon-plus"), array('label' => 'Додати предмет напрямкку', 'url' => array('create'), 'icon' => "icon-plus"));
Yii::app()->clientScript->registerScript('search', "\r\n\$('.search-button').click(function(){\r\n\t\$('.search-form').toggle();\r\n\treturn false;\r\n});\r\n\$('.search-form form').submit(function(){\r\n\t\$.fn.yiiGridView.update('specialitysubjects-grid', {\r\n\t\tdata: \$(this).serialize()\r\n\t});\r\n\treturn false;\r\n});\r\n");
?>
<h1>Управління предметами напрямків</h1>
<p>
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>
<!--
<?php
echo CHtml::link('Advanced Search', '#', array('class' => 'search-button btn'));
?>
<div class="search-form" style="display:none">
<?php
$this->renderPartial('_search', array('model' => $model));
?>
</div> search-form -->
<?php
$data = $model->search();
$Specialities = new Specialities();
$d = $Specialities->getSpecialityFullNames();
$this->widget('bootstrap.widgets.TbGroupGridView', array('id' => 'specialitysubjects-grid', 'type' => 'striped bordered condensed', 'dataProvider' => $data, 'filter' => $model, 'mergeColumns' => array('SpecialityID'), 'columns' => array(array('name' => 'SpecialityID', 'value' => '$data->speciality->SpecialityDirectionName." ".$data->speciality->SpecialitySpecializationName." (".
(($data->speciality->PersonEducationFormID==1)?("денна"):(($data->speciality->PersonEducationFormID==2)?("заочна"):("екстернат"))).")"', 'filter' => $d), array('name' => 'SubjectID', 'value' => '$data->subject->SubjectName', 'filter' => CHtml::listData(Subjects::model()->findAll(), "idSubjects", "SubjectName")), array('name' => 'LevelID', 'filter' => array("1" => "1", "2" => "2", "3" => "3"), "htmlOptions" => array("style" => "width: 100px")), array('name' => 'isProfile', 'filter' => array('1' => 'так', '0' => 'ні'), "htmlOptions" => array("style" => "width: 100px"), 'value' => '($data->isProfile)? "так":"ні"'), array('class' => 'bootstrap.widgets.TbButtonColumn'))));
示例15: getSubject
/**
* @return \yii\db\ActiveQuery
*/
public function getSubject()
{
return $this->hasOne(Subjects::className(), ['id' => 'subject_id']);
}