Ejemplo n.º 1
0
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = '`file`<>:null';
     $criteria->params = array(':null' => '');
     $roles = Rights::getAssignedRoles(Yii::app()->user->id);
     // check for single role
     $user_roles = array();
     foreach ($roles as $role) {
         $user_roles[] = '"' . $role->name . '"';
     }
     $teacher = Employees::model()->findByAttributes(array('uid' => Yii::app()->user->id));
     $batches = Batches::model()->findAllByAttributes(array('employee_id' => $teacher->id));
     foreach ($batches as $classteacher) {
         $batch[] = $classteacher->id;
     }
     $timetable = TimetableEntries::model()->findAllByAttributes(array('employee_id' => $teacher->id));
     foreach ($timetable as $period) {
         $batch[] = $period->batch_id;
     }
     $unique_batch = array_unique($batch);
     if (count($unique_batch) > 0) {
         $criteria->condition .= ' AND (`placeholder`=:null OR `created_by`=:user_id OR (`placeholder` IN (' . implode(',', $user_roles) . ')) AND (`batch` IS NULL OR `batch` IN (' . implode(',', $unique_batch) . '))) ';
     } else {
         $criteria->condition .= ' AND (`placeholder`=:null OR `created_by`=:user_id) OR (`placeholder` IN (' . implode(',', $user_roles) . '))';
     }
     $criteria->params[':user_id'] = Yii::app()->user->id;
     $criteria->order = '`created_at` DESC';
     $files = FileUploads::model()->findAll($criteria);
     if (isset($_POST['Downfiles'])) {
         $selected_files = $_POST['Downfiles'];
         $slfiles = array();
         foreach ($selected_files as $s_file) {
             $model = FileUploads::model()->findByPk($s_file);
             if ($model != NULL) {
                 $slfiles[] = 'uploads/shared/' . $model->id . '/' . $model->file;
             }
         }
         $zip = Yii::app()->zip;
         $fName = $this->generateRandomString(rand(10, 20)) . '.zip';
         $zipFile = 'compressed/' . $fName;
         if ($zip->makeZip($slfiles, $zipFile)) {
             $fcon = file_get_contents($zipFile);
             header('Content-type:text/plain');
             header('Content-disposition:attachment; filename=' . $fName);
             header('Pragma:no-cache');
             echo $fcon;
             unlink($zipFile);
         } else {
             Yii::app()->user->setFlash('success', 'Can\'t download');
         }
     }
     $this->render('/fileUploads/index', array('files' => $files));
 }
Ejemplo n.º 2
0
    	<?php 
            echo '<span>' . Yii::t('Batch', 'Notice') . '</span>';
            ?>
        <?php 
            echo Yii::t('Batch', 'No Batch Class Timings are defined.');
            ?>
<br />
        <?php 
            echo CHtml::link(Yii::t('Batch', 'Define Now'), array('#'), array('id' => 'add_class-timings-side'));
            ?>
</div>
        <?php 
        }
        ?>
        <?php 
        $ttab = TimetableEntries::model()->findByAttributes(array('batch_id' => $batch->id));
        if ($ttab == NULL) {
            ?>
        <div class="notifications <?php 
            echo $time;
            ?>
">
    	<?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']));
Ejemplo n.º 3
0
        }
        if ($weekdays[6]['weekday'] != 0) {
            ?>
														<tr>
															<td class="td"><div class="name"><?php 
            echo Yii::t('weekdays', 'SAT');
            ?>
</div></td>
															<td class="td-blank"></td>
															<?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>';
Ejemplo n.º 4
0
	<?php 
/*If $flag = 1, list of batches will be displayed. 
 *If $flag = 2, exam schedule page will be displayed.
 *If $flag = 3, exam result page will be displayed.
 *If $flag = 0, Employee not teaching in any batch. A message will be displayed.
 */
if ($_REQUEST['id'] != NULL) {
} else {
    // Get unique batch ID from Timetable
    $criteria = new CDbCriteria();
    $criteria->select = 'batch_id';
    $criteria->distinct = true;
    // $criteria->order = 'batch_id ASC'; Uncomment if ID should be retrieved in ascending order
    $criteria->condition = 'employee_id=:emp_id';
    $criteria->params = array(':emp_id' => $employee_id);
    $batches_id = TimetableEntries::model()->findAll($criteria);
    if (count($batches_id) >= 1) {
        // List of batches is needed
        $flag = 1;
    } elseif (count($batches_id) <= 0) {
        // If not teaching in any batch
        $flag = 0;
    }
}
if ($flag == 0) {
    // Displaying message
    ?>
    <div class="yellow_bx" style="background-image:none;width:90%;padding-bottom:45px;margin-top:60px;">
        <div class="y_bx_head">
           <?php 
    echo Yii::t('examination', 'No period is assigned to you now!');
        	<li style="border-right:1px #d9e1e7 solid"><span><?php 
        echo count(Students::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])));
        ?>
</span><?php 
        echo Yii::t('Batch', 'Students');
        ?>
</li>
            <li style="border-left:1px #fff solid;border-right:1px #d9e1e7 solid;"><span><?php 
        echo count(Subjects::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])));
        ?>
</span><?php 
        echo Yii::t('Batch', 'Subjects');
        ?>
</li>
            <li style="border-left:1px #fff solid"><span><?php 
        echo count(TimetableEntries::model()->findAll(array('condition' => 'batch_id=:x', 'group' => 'employee_id', 'params' => array(':x' => $_REQUEST['id']))));
        ?>
</span><?php 
        echo Yii::t('Batch', 'Employees');
        ?>
</li>
        </ul>
     <div class="clear"></div>
    </div>
	<div class="namelist">
    	<ul>
        	<li><?php 
        echo '<strong>' . Yii::t('Batch', 'Class Teacher : ') . '</strong>';
        ?>
 
			<?php 
 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;
     }
 }
Ejemplo n.º 7
0
 public function scorelabel($data, $row)
 {
     $employee = Employees::model()->findByAttributes(array('uid' => Yii::app()->user->id));
     $is_teaching = TimetableEntries::model()->countByAttributes(array('subject_id' => $data->subject_id, 'employee_id' => $employee->id));
     if ($is_teaching > 0 or Yii::app()->controller->action->id == 'classexam') {
         return "Manage Scores";
     } else {
         return "View Scores";
     }
 }
Ejemplo n.º 8
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'));
     }
 }
Ejemplo n.º 9
0
Yii::app()->clientScript->registerScript('ajax-link-handler1', "\n\$('#student_div a').live('click', function(event){\n\t\$.ajax({\n                'type':'get',\n                'url':\$(this).attr('href'),\n                'dataType': 'html',\n                'success':function(data){\n\t\t\t\t\tvar label = data.split('@#\$`')[0];\n\t\t\t\t\tvar id = data.split('@#\$`')[1];\n\t\t\t\t\t\n                        \$('#name_widget').val(label);\n\t\t\t\t\t\t\$('#id_widget').val(id);\n\t\t\t\t\t\t\$('#explorer_handler').html('');\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n                }\n        });\n        event.preventDefault();\n});\n");
Yii::app()->clientScript->registerScript('ajax-link-handler1-user', "\n\$('#user_div a').live('click', function(event){\n\t\$.ajax({\n                'type':'get',\n                'url':\$(this).attr('href'),\n                'dataType': 'html',\n                'success':function(data){\n\t\t\t\t\tvar label = data.split('@#\$`')[0];\n\t\t\t\t\tvar id = data.split('@#\$`')[1];\n\t\t\t\t\t\n                        \$('#name_widget').val(label);\n\t\t\t\t\t\t\$('#id_widget').val(id);\n\t\t\t\t\t\t\$('#explorer_handler').html('');\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n                }\n        });\n        event.preventDefault();\n});\n");
$setup_stu = false;
$setup_emp = false;
$setup_cou = false;
$setup_fee = false;
$setup_tim = false;
$setup_lib = false;
$setup_hos = false;
$setup_tra = false;
$setups = 0;
$exp_stu = Students::model()->findAll();
$exp_emp = Employees::model()->findAll();
$exp_cou = Courses::model()->findAll();
$exp_fee = FinanceFeeCategories::model()->findAll();
$exp_tim = TimetableEntries::model()->findAll();
Yii::app()->getModule('library');
$exp_lib = Book::model()->findAll();
Yii::app()->getModule('hostel');
$exp_hos = Hosteldetails::model()->findAll();
Yii::app()->getModule('transport');
$exp_tra = RouteDetails::model()->findAll();
if (count($exp_stu)) {
    $setup_stu = true;
    $setups++;
}
if (count($exp_emp)) {
    $setup_emp = true;
    $setups++;
}
if (count($exp_cou)) {
Ejemplo n.º 10
0
        	</li>
            <?php 
}
?>
            <li>
        	<?php 
echo CHtml::link('<span>' . Yii::t('examination', 'Change Batch') . '</span>', array($url), array('id' => 'add_exam-groups', 'class' => 'addbttn'));
?>
        	</li>
        </ul>
        <div class="clear"></div>
    </div>
    
    <?php 
$result_published = ExamGroups::model()->countByAttributes(array('id' => $exam_group_id, 'result_published' => 1));
$is_teaching_subject = TimetableEntries::model()->countByAttributes(array('subject_id' => $subject_id->subject_id, 'employee_id' => $employee_id));
$score_flag = 0;
// If $score_flag == 0, form for editing scores will not be displayed. If $score_flag == 1, form will be displayed.
if ((Yii::app()->controller->action->id == 'classexam' or Yii::app()->controller->action->id == 'update') and $classteacher->id == $employee_id or Yii::app()->controller->action->id == 'update' and $_REQUEST['allexam'] == 1) {
    // Class teacher and subject teacher can edit scores for all subjects in their batch.
    $score_flag = 1;
}
if (Yii::app()->controller->action->id == 'allexam' and $is_teaching_subject <= 0) {
    $score_flag = 0;
}
/*echo 'Result Published: '.$result_published.'<br/>';
	echo 'Is Teaching Subject: '.$is_teaching_subject.'<br/>';
	echo 'Score Flag: '.$score_flag.'<br/>';*/
if ($score_flag == 1) {
    ?>
	<!-- Start Edit Exam Scores -->
Ejemplo n.º 11
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;
 }
 /**
  * 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 = TimetableEntries::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 13
0
                        </tr>
                        <tr>
							<td class="td"><div class="name"><?php 
            echo Yii::t('timetable', $day_name);
            ?>
</div></td>
                                <td class="td-blank"></td>
                                <?php 
            for ($i = 0; $i < $count_timing; $i++) {
                ?>
								<td class="td">
                                    <div  onclick="" style="position: relative; ">
                                        <div class="tt-subject" style="width:120px; margin:0 auto;">
                                            <div class="subject">
                                            <?php 
                $set = TimetableEntries::model()->findByAttributes(array('batch_id' => $batch_id, 'weekday_id' => $day, 'class_timing_id' => $timing[$i]['id']));
                if ($set != NULL) {
                    $time_sub = Subjects::model()->findByAttributes(array('id' => $set->subject_id));
                    if ($time_sub != NULL) {
                        echo ucfirst($time_sub->name) . '<br>';
                    }
                    $time_emp = Employees::model()->findByAttributes(array('id' => $set->employee_id));
                    if ($time_emp != NULL) {
                        echo '<div class="employee">' . ucfirst($time_emp->first_name) . ' ' . ucfirst($time_emp->middle_name) . ' ' . ucfirst($time_emp->last_name) . '</div>';
                    }
                } else {
                    $is_break = ClassTimings::model()->findByAttributes(array('id' => $timing[$i]['id'], 'is_break' => 1));
                    if ($is_break != NULL) {
                        echo Yii::t('timetable', 'Break');
                    }
                }