コード例 #1
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Subjects::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #2
0
ファイル: Subjects.php プロジェクト: akilraj1255/rajeshwari
 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');
     }
 }
コード例 #3
0
 /**
  * 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));
 }
コード例 #4
0
ファイル: Subjects.php プロジェクト: upmunspel/abiturient
 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;
 }
コード例 #5
0
ファイル: Exams.php プロジェクト: SoftScape/open-school-CE
 public function subjectname($data, $row)
 {
     $subject = Subjects::model()->findByAttributes(array('id' => $data->subject_id));
     return $subject->name;
 }
コード例 #6
0
ファイル: _form.php プロジェクト: akilraj1255/rajeshwari
</table>

    
    
   <h3><?php 
        echo Yii::t('examination', ' Enter exam related details here:');
        ?>
</h3>
    
<div class="tableinnerlist">
<table width="95%" cellspacing="0" cellpadding="0">


<?php 
        if (isset($_REQUEST['id'])) {
            $posts = Subjects::model()->findAll("batch_id=:x AND no_exams=:y", array(':x' => $_REQUEST['id'], ':y' => 0));
            if (count($posts) != 0) {
                $c = count($posts);
                $i = 1;
                $j = 0;
                foreach ($posts as $posts_1) {
                    $c--;
                    $checksub = Exams::model()->findByAttributes(array('exam_group_id' => $_REQUEST['exam_group_id'], 'subject_id' => $posts_1->id));
                    if ($checksub == NULL) {
                        if ($j == 0) {
                            ?>
              <?php 
                            echo $form->labelEx($model, 'max_mark');
                            ?>
                  <?php 
                            echo $form->textField($model, 'max_mark', array('id' => 'max_mark'));
コード例 #7
0
 /**
  * Метод асинхронно повертає список предметів ЗНО
  */
 public function actionZno()
 {
     $models = Subjects::model()->findAll('idZNOSubject>0 ORDER BY SubjectName ASC');
     $result = array();
     foreach ($models as $model) {
         /* @var $model Subjects */
         $result[] = array('text' => $model->SubjectName, 'id' => $model->idSubjects);
     }
     echo CJSON::encode($result);
 }
コード例 #8
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         $model = ExamScores::model()->findByAttributes(array('id' => $id));
         $student = Students::model()->findByAttributes(array('id' => $model->student_id));
         $student_name = ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name);
         $exam = Exams::model()->findByAttributes(array('id' => $model->exam_id));
         $subject_name = Subjects::model()->findByAttributes(array('id' => $exam->subject_id));
         $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id));
         $batch = Batches::model()->findByAttributes(array('id' => $examgroup->batch_id));
         $exam_name = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')';
         $goal_name = $student_name . ' for the exam ' . $exam_name;
         // we only allow deletion via POST request
         $this->loadModel($id)->delete();
         //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
         ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '22', $model->id, $goal_name, NULL, NULL, NULL);
         // we only allow deletion via POST request
         //$this->loadModel($id)->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
コード例 #9
0
    	<?php 
            echo '<span>' . Yii::t('Batch', 'Notice') . '</span>';
            ?>
       <?php 
            echo Yii::t('Batch', 'Time Table Not Created.');
            ?>
 <br />
        <?php 
            echo CHtml::link(Yii::t('Batch', 'Create Now'), array('weekdays/timetable', 'id' => $_REQUEST['id']));
            ?>
</div>
        <?php 
        }
        ?>
        <?php 
        $sub = Subjects::model()->findByAttributes(array('batch_id' => $batch->id));
        if ($sub == NULL) {
            ?>
        <div class="notifications nt_red">
    	<?php 
            echo '<span>' . Yii::t('Batch', 'Notice') . '</span>';
            ?>
        <?php 
            echo Yii::t('Batch', 'No Subjects Added');
            ?>
.<br />
        <?php 
            echo CHtml::link(Yii::t('Batch', 'Add Now'), array('#'), array('id' => 'add_subjects-side'));
            ?>
</div>
        <?php 
コード例 #10
0
ファイル: admin.php プロジェクト: upmunspel/abiturient
//	'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>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</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'))));
コード例 #11
0
 public function actionBookSearch()
 {
     if (isset($_POST['search'])) {
         if (isset($_POST['search']) && isset($_POST['text'])) {
             $criteria = new CDbCriteria();
             $criteria->compare('is_deleted', 0);
             // normal DB field
             $criteria->condition = 'is_deleted=:is_del';
             $criteria->params = array(':is_del' => 0);
             if ($_POST['search'] == 1) {
                 $sub = Subjects::model()->findByAttributes(array('name' => $_POST['text']));
                 if ($sub != NULL) {
                     $criteria->condition = 'subject LIKE :match';
                     $criteria->params = array(':match' => $sub->id . '%');
                 }
             }
             if ($_POST['search'] == 2) {
                 $criteria->condition = 'title LIKE :match';
                 $criteria->params = array(':match' => $_POST['text'] . '%');
             }
             if ($_POST['search'] == 3) {
                 $author = Author::model()->findByAttributes(array('author_name' => $_POST['text']));
                 if ($author != NULL) {
                     $criteria->condition = 'author LIKE :match';
                     $criteria->params = array(':match' => $author->auth_id . '%');
                 }
             }
             if ($_POST['search'] == 4) {
                 $criteria->condition = 'isbn LIKE :match';
                 $criteria->params = array(':match' => $_POST['text'] . '%');
             }
         }
         $total = Book::model()->count($criteria);
         $pages = new CPagination($total);
         $pages->setPageSize(Yii::app()->params['listPerPage']);
         $pages->applyLimit($criteria);
         // the trick is here!
         $posts = Book::model()->findAll($criteria);
         $this->render('booksearch', array('list' => $posts, 'pages' => $pages, 'item_count' => $total, 'page_size' => Yii::app()->params['listPerPage']));
     } else {
         $this->render('booksearch');
     }
 }
コード例 #12
0
ファイル: _form.php プロジェクト: upmunspel/abiturient
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'specialitysubjects-form', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>

	<p class="help-block">Fields with <span class="required">*</span> are required.</p>

	<?php 
if (empty($SpecialityID)) {
    $SpecialityID = 0;
}
echo CHtml::dropDownList("SpecialityID", $SpecialityID, Specialities::DropDown(), array('empty' => "", 'class' => 'span5'));
$c = new CDbCriteria();
$c->order = 'SubjectName';
$c->compare('idZNOSubject', '>0');
$data = CHtml::listData(Subjects::model()->findAll($c), "idSubjects", "SubjectName");
$dataCount = count($data);
?>
        <div class ="row-fluid">
            <?php 
echo $form->error($models[0], "SpecialityID");
?>
        </div>
        
        <div class ="row-fluid">
            <?php 
foreach ($models as $i => $model) {
    ?>
            <div class="span4">
                <?php 
    echo $form->error($model, "[{$i}]SubjectID");
コード例 #13
0
ファイル: VkCommand.php プロジェクト: sc0rp1d/studyschedule
 public function actionWhoHasSubjectTomorrow($subject_id)
 {
     $semester = Semesters::model()->actual();
     if (!$semester) {
         throw new CException('Нет семестра');
     }
     $tomorrow_date = (new DateTime())->add(new DateInterval("P1D"))->format('Y-m-d');
     $tomorrow_time = strtotime($tomorrow_date);
     if (Holiday::model()->findByAttributes(['date' => $tomorrow_date]) || date('N', $tomorrow_time) == 7) {
         throw new CException('Завтра выходной');
     }
     $week_number = ($semester->week_number + (date('W', $tomorrow_time) - date('W', strtotime($semester->start_date)))) % 2 ? 1 : 2;
     $week_day = date('N', $tomorrow_time);
     /** @var Subjects $subject */
     $subject = Subjects::model()->findByPk($subject_id);
     if (!$subject) {
         throw new CException('Нет такого предмета');
     }
     /** @var GroupReplace[] $replaces */
     $replaces = $subject->getRelated('replaces', true, ['with' => 'group', 'condition' => 'date = :tomorrow_date', 'params' => [':tomorrow_date' => $tomorrow_date]]);
     /** @var ScheduleElement[] $schedule_elements */
     $schedule_elements = $subject->getRelated('schedule_elements', true, ['with' => 'group', 'condition' => 'week_number = :week_number AND week_day = :week_day AND semester_id = :semester_id', 'params' => [':week_number' => $week_number, ':week_day' => $week_day, ":semester_id" => $semester->id]]);
     $schedule = [];
     if ($schedule_elements) {
         foreach ($schedule_elements as $schedule_element) {
             /** @var GroupReplace $replace */
             if ($replace = GroupReplace::model()->findByAttributes(['date' => $tomorrow_date, 'number' => $schedule_element->number, 'group_id' => $schedule_element->group_id])) {
                 if ($replace->subject_id != $subject_id) {
                     continue;
                 }
             }
             $schedule[$schedule_element->number][] = (int) $schedule_element->group->number;
         }
     }
     if ($replaces) {
         foreach ($replaces as $replace) {
             if (!isset($schedule[$replace->number])) {
                 $schedule[$replace->number] = [];
             }
             if (!in_array((int) $replace->group->number, $schedule[$replace->number])) {
                 $schedule[$replace->number][] = (int) $replace->group->number;
             }
         }
     }
     ksort($schedule);
     $schedule_text = 'У кого завтра ' . $subject->name . '?' . PHP_EOL;
     if (count($schedule)) {
         foreach ($schedule as $number => $groups) {
             $schedule_text .= $number . ') ' . implode(', ', $groups) . PHP_EOL;
         }
     } else {
         $schedule_text .= 'А мы не знаем :-(' . PHP_EOL;
     }
     $schedule_text .= PHP_EOL . 'Данные предоставлены проектом @studyschedule (Расписание ККЭП)';
     $params = http_build_query(['owner_id' => $this->owner_id, 'message' => $schedule_text, 'from_group' => 1, 'access_token' => $this->access_token]);
     if ($result = file_get_contents('https://api.vk.com/method/wall.post?' . $params)) {
         var_dump(json_decode($result, true));
     } else {
         echo 'Error when send request...';
     }
     echo PHP_EOL;
 }
コード例 #14
0
 public function actionUpdate($id)
 {
     $model = ExamScores::model()->findByAttributes(array('id' => $id));
     $old_model = $model->attributes;
     // For activity feed
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ExamScores'])) {
         $model->attributes = $_POST['ExamScores'];
         $exam = Exams::model()->findByAttributes(array('id' => $_REQUEST['exam_id']));
         if ($model->marks < $exam->minimum_marks) {
             $model->is_failed = 1;
         } else {
             $model->is_failed = '';
         }
         if ($model->save()) {
             // Saving to activity feed
             $results = array_diff_assoc($model->attributes, $old_model);
             // To get the fields that are modified.
             foreach ($results as $key => $value) {
                 if ($key != 'updated_at') {
                     $student = Students::model()->findByAttributes(array('id' => $model->student_id));
                     $student_name = ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name);
                     $subject_name = Subjects::model()->findByAttributes(array('id' => $exam->subject_id));
                     $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id));
                     $batch = Batches::model()->findByAttributes(array('id' => $examgroup->batch_id));
                     $exam_name = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')';
                     $goal_name = $student_name . ' for the exam ' . $exam_name;
                     if ($key == 'is_failed') {
                         if ($value == 1) {
                             $value = 'Fail';
                         } else {
                             $value = 'Pass';
                         }
                         if ($old_model[$key] == 1) {
                             $old_model[$key] = 'Fail';
                         } else {
                             $old_model[$key] = 'Pass';
                         }
                     }
                     //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
                     ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '21', $model->id, $goal_name, $model->getAttributeLabel($key), $old_model[$key], $value);
                 }
             }
             //END saving to activity feed
             if ($_REQUEST['allexam'] == 1) {
                 $url = 'default/allexam';
             } else {
                 $url = 'default/classexam';
             }
             $this->redirect(array($url, 'bid' => $_REQUEST['bid'], 'exam_group_id' => $_REQUEST['exam_group_id'], 'r_flag' => $_REQUEST['r_flag'], 'exam_id' => $_REQUEST['exam_id']));
         }
     }
     $this->render('examination/examination', array('model' => $model));
 }
コード例 #15
0
ファイル: _form.php プロジェクト: akilraj1255/rajeshwari
    $sel = '';
}
echo '<div class="formCon"><div class="formConInner"><div style="float:left; width:380px;"><span style="font-size:14px; font-weight:bold; color:#666;">Course</span>&nbsp;&nbsp;&nbsp;&nbsp;';
echo CHtml::dropDownList('id', '', $data, array('prompt' => 'Select', 'onchange' => 'course()', 'id' => 'cou', 'options' => array($sel => array('selected' => true))));
echo '</div>';
echo '<div style="float:left; width:300px;"><span style="font-size:14px; font-weight:bold; color:#666;">Subject</span>&nbsp;&nbsp;';
?>


<?php 
$data_1 = array();
if (isset($_REQUEST['cou'])) {
    $batches = Batches::model()->findAll("course_id=:x and is_deleted=:y", array(':x' => $_REQUEST['cou'], ':y' => 0));
    /*$data_1=Subjects::model()->findAll(array('join' => 'JOIN batches ON batch_id = batches.id','condition'=>'batches.course_id=:id', 
      'params'=>array(':id'=>(int) $_REQUEST['cou'])));*/
    $data_1 = CHtml::listData(Subjects::model()->findAll(array('join' => 'JOIN batches ON batch_id = batches.id', 'condition' => 'batches.course_id=:id and elective_group_id=:x', 'params' => array(':id' => (int) $_REQUEST['cou'], ':x' => 0))), 'id', 'batchname');
}
if (isset($_REQUEST['sub'])) {
    $sel_1 = $_REQUEST['sub'];
} else {
    $sel_1 = '';
}
echo CHtml::dropDownList('sub', '', $data_1, array('prompt' => 'Select', 'onchange' => 'course()', 'id' => 'sub', 'onchange' => 'batch()', 'options' => array($sel_1 => array('selected' => true))));
echo '<br/></div><div class="clear"></div></div></div>';
?>
    
<?php 
if (isset($_REQUEST['sub'])) {
    $emp_sub = EmployeesSubjects::model()->findAll("subject_id=:x", array(':x' => $_REQUEST['sub']));
    if (count($emp_sub) == 0) {
        echo '<br> <br>' . Yii::t('employees', '<i>No Employee assigned yet.</i>') . '<br> <br>';
コード例 #16
0
 public function actionRemove()
 {
     $val = $_GET['val1'];
     $model = Batches::model()->findByPk($val);
     $model->is_active = 0;
     $model->is_deleted = 1;
     $model->employee_id = ' ';
     if ($model->save()) {
         // Student Deletion
         $students = Students::model()->findAllByAttributes(array('batch_id' => $model->id));
         foreach ($students as $student) {
             //Making student user inactive
             if ($student->uid != NULL and $student->uid != 0) {
                 $student_user = User::model()->findByAttributes(array('id' => $student->uid));
                 if ($student_user != NULL) {
                     $student_user->saveAttributes(array('status' => '0'));
                 }
             }
             //Making parent user inactive
             $parent = Guardians::model()->findByAttributes(array('ward_id' => $student->id));
             if ($parent->uid != NULL and $parent->uid != 0) {
                 $parent_user = User::model()->findByAttributes(array('id' => $parent->uid));
                 if ($parent_user != NULL) {
                     $parent_user->saveAttributes(array('status' => '0'));
                 }
             }
             $student->saveAttributes(array('is_active' => '0', 'is_deleted' => '1'));
             // Student Deleted
         }
         // Subject Association Deletion
         $subjects = Subjects::model()->findAllByAttributes(array('batch_id' => $model->id));
         foreach ($subjects as $subject) {
             EmployeesSubjects::model()->DeleteAllByAttributes(array('subject_id' => $subject->id));
             $subject->delete();
         }
         // Exam Group Deletion
         $examgroups = ExamGroups::model()->findAllByAttributes(array('batch_id' => $model->id));
         foreach ($examgroups as $examgroup) {
             // Exams Deletion
             $exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $examgroup->id));
             foreach ($exams as $exam) {
                 //Exam Score Deletion
                 $examscores = ExamScores::model()->DeleteAllByAttributes(array('exam_id' => $exam->id));
                 $exam->delete();
                 //Exam Deleted
             }
             $examgroup->delete();
             //Exam Group Deleted
         }
         //Fee Collection Deletion
         $collections = FinanceFeeCollections::model()->findAllByAttributes(array('batch_id' => $model->id));
         foreach ($collections as $collection) {
             // Finance Fees Deletion
             $student_fees = FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $collection->id));
             $collection->delete();
             // Fee Collection Deleted
         }
         //Fee Category Deletion
         $categories = FinanceFeeCategories::model()->findAllByAttributes(array('batch_id' => $model->id));
         foreach ($categories as $category) {
             // Fee Particular Deletion
             $particulars = FinanceFeeParticulars::model()->DeleteAllByAttributes(array('finance_fee_category_id' => $category->id));
             $category->delete();
             // Fee Category Deleted
         }
         //Timetable Entry Deletion
         $periods = TimetableEntries::model()->DeleteAllByAttributes(array('batch_id' => $model->id));
         //Class Timings Deletion
         $class_timings = ClassTimings::model()->DeleteAllByAttributes(array('batch_id' => $model->id));
         //Delete Weekdays
         $weekdays = Weekdays::model()->DeleteAllByAttributes(array('batch_id' => $model->id));
     }
     echo $val;
 }
コード例 #17
0
ファイル: _form1.php プロジェクト: akilraj1255/rajeshwari
<div class="formCon" style="width:60%">
    <div class="formConInner" >
    	<?php 
$exam = Subjects::model()->findByAttributes(array('id' => $model->subject_id));
$exam_group = ExamGroups::model()->findByAttributes(array('id' => $model->exam_group_id));
?>
        <table width="50%">
        	<tr>
            	<td><strong><?php 
echo Yii::t('examination', 'Examination:');
?>
 </strong><?php 
echo ucfirst($exam_group->name);
?>
</td>
                <td><strong><?php 
echo Yii::t('examination', 'Subject:');
?>
 </strong><?php 
echo ucfirst($exam->name);
?>
</td>
			</tr>
        </table>
    </div>
</div>



<div class="formCon" style="width:60%">
コード例 #18
0
 public function actionAjax_delete()
 {
     $id = $_POST['id'];
     $subject = Subjects::model()->findByAttributes(array('elective_group_id' => $id));
     $timetable = TimetableEntries::model()->deleteAllByAttributes(array('subject_id' => $subject->id));
     $examgroup = Exams::model()->deleteAllByAttributes(array('subject_id' => $subject->id));
     EmployeeElectiveSubjects::model()->deleteAllByAttributes(array('subject_id' => $subject->id));
     $subject->delete();
     $deleted = $this->loadModel($id);
     if ($deleted->delete()) {
         echo json_encode(array('success' => true));
         exit;
     } else {
         echo json_encode(array('success' => false));
         exit;
     }
 }
コード例 #19
0
 public function actionSubject()
 {
     $data = Subjects::model()->findAll(array('join' => 'JOIN batches ON batch_id = batches.id', 'condition' => 'batches.course_id=:id', 'params' => array(':id' => (int) $_POST['id'])));
     $data = CHtml::listData($data, 'id', 'name');
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
コード例 #20
0
 * @copyright Copyright &copy; 2011-2012 Spiros Kabasakalis
 * @since 1.0
 * @ver 1.3
 -->
<?php 
if (!$model->isNewRecord) {
    $criteria = new CDbCriteria();
    $criteria->condition = 'batch_id=:bat_id';
    $criteria->params = array(':bat_id' => $model->batch_id);
    $criteria->compare('is_deleted', 0);
}
$data = CHtml::listData(SubjectName::model()->findAll(), 'id', 'name');
?>
 
<?php 
$data1 = CHtml::listData(Subjects::model()->findAll($criteria), 'id', 'name');
?>
<div id="subjects_form_con" class="client-val-form" style="width:350px">
    <?php 
if ($model->isNewRecord) {
    ?>
    <h3 id="create_header"><?php 
    echo Yii::t('Subjects', 'Add New Subject');
    ?>
</h3>
    <?php 
} elseif (!$model->isNewRecord) {
    ?>
    <h3 id="update_header"><?php 
    echo Yii::t('Subjects', 'Update Subject');
    ?>
コード例 #21
0
ファイル: attentstud.php プロジェクト: akilraj1255/rajeshwari
            break;
        case 3:
            return 'W<br>';
            break;
        case 4:
            return 'T<br>';
            break;
        case 5:
            return 'F<br>';
            break;
        case 6:
            return 'S<br>';
            break;
    }
}
$subjects = Subjects::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id']));
//echo CHtml::dropDownList('batch_id','',CHtml::listData(Subjects::model()->findAll("batch_id=:x",array(':x'=>$_REQUEST['id'])), 'id', 'name'), array('empty'=>'Select Type'));
$model = new EmployeeAttendances();
if (isset($_REQUEST['id'])) {
    if (!isset($_REQUEST['mon'])) {
        $mon = date('F');
        $mon_num = date('n');
        $curr_year = date('Y');
    } else {
        $mon = $model->getMonthname($_REQUEST['mon']);
        $mon_num = $_REQUEST['mon'];
        $curr_year = date('Y');
    }
    $num = cal_days_in_month(CAL_GREGORIAN, $mon_num, $curr_year);
    // 31
    ?>
コード例 #22
0
ファイル: booksearch.php プロジェクト: akilraj1255/rajeshwari
<td align="center"><?php 
                echo Yii::t('library', 'Total Copies');
                ?>
</td>
<td align="center"><?php 
                echo Yii::t('library', 'Book Position');
                ?>
</td>
<td align="center"><?php 
                echo Yii::t('library', 'Shelf No');
                ?>
</td>
</tr>
<?php 
                foreach ($list as $list_1) {
                    $sub = Subjects::model()->findByAttributes(array('id' => $list_1->subject));
                    $author = Author::model()->findByAttributes(array('auth_id' => $list_1->author));
                    $total_copies = $list_1->copy + $list_1->copy_taken;
                    ?>
<tr>
<td align="center"><?php 
                    echo $sub->name;
                    ?>
</td>
<td align="center"><?php 
                    echo $list_1->title;
                    ?>
</td>
<td align="center"><?php 
                    echo $list_1->isbn;
                    ?>
コード例 #23
0
</h1> 
    <div class="formCon" >
    <div class="formConInner">    
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    
    

<td width="10%">               
<?php 
        //echo CHtml::dropDownList('',isset($_REQUEST['id'])? $_REQUEST['id'] : '',CHtml::listData(Subjects::model()->findAll(),'id','name'),
        //array('prompt'=>'select', 'onchange'=>"javascript:booklist();", 'id'=>'id'));
        echo CHtml::label(Yii::t('library', 'Subject'), '') . '</td><td> ';
        $criteria = new CDbCriteria();
        $criteria->compare('is_deleted', 0);
        echo CHtml::dropDownList('subject', '', CHtml::listData(Subjects::model()->findAll($criteria), 'id', 'name'), array('prompt' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/library/book/subjects'), 'update' => '#book_id', 'data' => 'js:$(this).serialize()'))) . '</td></tr><tr><td>&nbsp;</td></tr><tr><td>';
        echo CHtml::label(Yii::t('library', 'Book'), '') . '</td><td>';
        echo CHtml::dropDownList('book', '', array(), array('prompt' => 'Select', 'id' => 'book_id', 'submit' => array('/library/book/booklist')));
        ?>
                        </td>
                          </tr>
</table>
                        </div>
                        </div>
                   </div>     
                        </td>
                        </tr>
                        </table>
                      <?php 
    }
}
コード例 #24
0
ファイル: _form.php プロジェクト: akilraj1255/rajeshwari
//echo $form->labelEx($model,'class_timing_id');
?>
   <?php 
echo $form->hiddenField($model, 'class_timing_id', array('value' => $class_timing_id));
?>
		<?php 
//echo $form->error($model,'class_timing_id');
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">  
<tr>
  	<td><?php 
echo $form->labelEx($model, Yii::t('timetable', 'subject_id'));
?>
</td>
    <td><?php 
echo $form->dropDownList($model, 'subject_id', CHtml::listData(Subjects::model()->findAll('batch_id=:x', array(':x' => $batch_id)), 'id', 'name'), array('prompt' => 'Select Subject', 'style' => 'width:200px;', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('TimetableEntries/dynamiccities'), 'update' => '#emp_id')));
?>
		<?php 
//echo $form->error($model,'subject_id');
?>
</td>
  </tr>
  <tr>
  	<td colspan="2">&nbsp;</td>
  </tr>
  <tr>
  <td><?php 
echo $form->labelEx($model, Yii::t('timetable', 'employee_id'));
?>
</td>
  <td><?php 
コード例 #25
0
ファイル: timetable.php プロジェクト: akilraj1255/rajeshwari
															<?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>';
            }
コード例 #26
0
 public function actionDeactivate($id)
 {
     $model = Courses::model()->findByPk($id);
     $model->is_deleted = 1;
     if ($model->save()) {
         // Batch Deletion
         $batches = Batches::model()->findAllByAttributes(array('course_id' => $id));
         //Selecting all batches under the course with id = $id
         foreach ($batches as $batch) {
             // Student Deletion
             $students = Students::model()->findAllByAttributes(array('batch_id' => $batch->id));
             foreach ($students as $student) {
                 //Making student user inactive
                 if ($student->uid != NULL and $student->uid != 0) {
                     $student_user = User::model()->findByAttributes(array('id' => $student->uid));
                     if ($student_user != NULL) {
                         $student_user->saveAttributes(array('status' => '0'));
                     }
                 }
                 //Making parent user inactive
                 $parent = Guardians::model()->findByAttributes(array('ward_id' => $student->id));
                 if ($parent->uid != NULL and $parent->uid != 0) {
                     $parent_user = User::model()->findByAttributes(array('id' => $parent->uid));
                     if ($parent_user != NULL) {
                         $parent_user->saveAttributes(array('status' => '0'));
                     }
                 }
                 $student->saveAttributes(array('is_active' => '0', 'is_deleted' => '1'));
                 // Student Deleted
             }
             // Subject Association Deletion
             $subjects = Subjects::model()->findAllByAttributes(array('batch_id' => $batch->id));
             foreach ($subjects as $subject) {
                 EmployeesSubjects::model()->DeleteAllByAttributes(array('subject_id' => $subject->id));
                 $subject->delete();
             }
             // Exam Group Deletion
             $examgroups = ExamGroups::model()->findAllByAttributes(array('batch_id' => $batch->id));
             foreach ($examgroups as $examgroup) {
                 // Exams Deletion
                 $exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $examgroup->id));
                 foreach ($exams as $exam) {
                     //Exam Score Deletion
                     $examscores = ExamScores::model()->DeleteAllByAttributes(array('exam_id' => $exam->id));
                     $exam->delete();
                     //Exam Deleted
                 }
                 $examgroup->delete();
                 //Exam Group Deleted
             }
             //Fee Collection Deletion
             $collections = FinanceFeeCollections::model()->findAllByAttributes(array('batch_id' => $batch->id));
             foreach ($collections as $collection) {
                 // Finance Fees Deletion
                 $student_fees = FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $collection->id));
                 $transaction = FinanceTransaction::model()->DeleteAllByAttributes(array('collection_id' => $collection->id));
                 $collection->delete();
                 // Fee Collection Deleted
             }
             //Fee Category Deletion
             $categories = FinanceFeeCategories::model()->findAllByAttributes(array('batch_id' => $batch->id));
             foreach ($categories as $category) {
                 // Fee Particular Deletion
                 $particulars = FinanceFeeParticulars::model()->DeleteAllByAttributes(array('finance_fee_category_id' => $category->id));
                 $category->delete();
                 // Fee Category Deleted
             }
             //Timetable Entry Deletion
             $periods = TimetableEntries::model()->DeleteAllByAttributes(array('batch_id' => $batch->id));
             //Class Timings Deletion
             $class_timings = ClassTimings::model()->DeleteAllByAttributes(array('batch_id' => $batch->id));
             //Delete Weekdays
             $weekdays = Weekdays::model()->DeleteAllByAttributes(array('batch_id' => $batch->id));
             $batch->is_active = 0;
             $batch->is_deleted = 1;
             $batch->employee_id = ' ';
             $batch->save();
             // Batch Deleted
         }
         Yii::app()->user->setFlash('success', "Selected course is deleted!");
         $this->redirect(array('managecourse'));
     }
 }
コード例 #27
0
 public function actionPdf()
 {
     $batch_name = Batches::model()->findByAttributes(array('id' => $_REQUEST['id']));
     $exam = Exams::model()->findByAttributes(array('id' => $_REQUEST['examid']));
     $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id));
     $subject = Subjects::model()->findByAttributes(array('id' => $exam->subject_id));
     $filename = $batch_name->name . ' ' . $examgroup->name . ' ' . $subject->name . '.pdf';
     # HTML2PDF has very similar syntax
     $html2pdf = Yii::app()->ePdf->HTML2PDF();
     $html2pdf->WriteHTML($this->renderPartial('scorepdf', array(), true));
     $html2pdf->Output($filename);
 }
コード例 #28
0
ファイル: _form.php プロジェクト: akilraj1255/rajeshwari
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php 
echo $form->labelEx($model, Yii::t('library', 'subject'));
?>
</td>
    <td>&nbsp;</td>
    <td><?php 
$criteria = new CDbCriteria();
$criteria->compare('is_deleted', 0);
echo $form->dropDownList($model, 'subject', CHtml::listData(Subjects::model()->findAll($criteria), 'id', 'name'), array('prompt' => 'Select'));
?>
		<?php 
//echo $form->error($model,'subject');
?>
</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php 
echo $form->labelEx($model, Yii::t('library', 'category'));
?>
コード例 #29
0
ファイル: exams.php プロジェクト: akilraj1255/rajeshwari
if ($exam == NULL) {
    echo '<tr><td align="center" colspan="4"><i>' . Yii::t('parentportal', 'No Assessments') . '</i></td></tr>';
} else {
    $displayed_flag = '';
    foreach ($exam as $exams) {
        $exm = Exams::model()->findByAttributes(array('id' => $exams->exam_id));
        $group = ExamGroups::model()->findByAttributes(array('id' => $exm->exam_group_id, 'result_published' => 1));
        $grades = GradingLevels::model()->findAllByAttributes(array('batch_id' => $exams->grading_level_id));
        $t = count($grades);
        if ($group != NULL and count($group) > 0) {
            echo '<tr>';
            if ($exm != NULL) {
                $displayed_flag = 1;
                //$group=ExamGroups::model()->findByAttributes(array('id'=>$exm->exam_group_id));
                echo '<td>' . $group->name . '</td>';
                $sub = Subjects::model()->findByAttributes(array('id' => $exm->subject_id));
                if ($sub->elective_group_id != 0 and $sub->elective_group_id != NULL) {
                    $student_elective = StudentElectives::model()->findByAttributes(array('student_id' => $student->id));
                    if ($student_elective != NULL) {
                        $electname = Electives::model()->findByAttributes(array('id' => $student_elective->elective_id, 'elective_group_id' => $sub->elective_group_id));
                        if ($electname != NULL) {
                            echo '<td>' . $electname->name . '</td>';
                        }
                    }
                } else {
                    echo '<td>' . $sub->name . '</td>';
                }
                if ($group->exam_type == 'Marks') {
                    echo "<td>" . $exams->marks . "</td>";
                } else {
                    if ($group->exam_type == 'Grades') {
コード例 #30
0
 public function actionAssign()
 {
     $model = new EmployeeElectiveSubjects();
     $elective = Electives::model()->findByAttributes(array('id' => $_REQUEST['elect']));
     $subject = Subjects::model()->findByAttributes(array('elective_group_id' => $elective->elective_group_id));
     $model->employee_id = $_REQUEST['emp_id'];
     $model->elective_id = $_REQUEST['elect'];
     $model->subject_id = $subject->id;
     $model->save();
     $this->redirect(array('employeesSubjects/create', 'bid' => $_REQUEST['bid'], 'elect' => $_REQUEST['elect'], 'dep' => $_REQUEST['dep']));
 }