Пример #1
0
 public function testCalculate()
 {
     $div = new Division();
     $this->assertEquals(2, $div->calculate(2, 1));
     $this->assertEquals(2, $div->calculate(4, 2));
     $this->assertEquals(0.5, $div->calculate(2, 4));
     $this->assertEquals(3, $div->calculate(2.1, 0.7));
 }
Пример #2
0
 function divisions($office_id = '')
 {
     $d = new Division();
     $divisions = $d->where('office_id', $office_id)->order_by('order')->get();
     $json = array();
     foreach ($divisions as $division) {
         $json[$division->id] = $division->name;
     }
     echo json_encode($json);
 }
 public function createByName($name)
 {
     print_r('[' . $name . ']');
     $document = new Division();
     $document->setName($name);
     $document->setSlug();
     $document->save();
     $document = $this->findOneBySlug($document->getSlug());
     return $document;
 }
Пример #4
0
 public function isAbove(Division $division)
 {
     if ($division->getParent()->getParent() && $division->getParent()->getParent()->getDivision() == $this->getDivision()) {
         return true;
     }
     if ($division->getParent() && $division->getParent()->getDivision() == $this->getDivision()) {
         return true;
     }
     return false;
 }
Пример #5
0
 public function save()
 {
     $divisionId = $this->getValue('divisionId');
     if (!empty($divisionId)) {
         $division = $this->getDivisionService()->getDivisionById($divisionId);
     } else {
         $division = new Division();
     }
     $division->setDivisionName($this->getValue('division_name'));
     $division->setDivisionCode($this->getValue('division_code'));
     $division->setCouCode($this->getValue('country'));
     $division->save();
 }
Пример #6
0
 /**
  * @param Division $division
  * @return Rank[]
  */
 public static function getDivisionRanks(Division $division)
 {
     global $mysqli;
     $ranks = array();
     $paygrades = array('E', 'O', 'C', 'HC', 'RT', 'S');
     foreach ($paygrades as $paygrade) {
         $query = $mysqli->query("SELECT * FROM ranks WHERE division = {$division->getDivision()} AND rank LIKE '{$paygrade}%' ORDER BY rank");
         if ($query->num_rows > 0) {
             while ($result = $query->fetch_array()) {
                 $ranks[] = new self($result['id']);
             }
         }
     }
     return $ranks;
 }
Пример #7
0
 /**
  * Singleton Pattern
  *
  * Auto Create Object Instance.
  *
  */
 public static function getInstance()
 {
     if (null === self::$_objInstance) {
         self::$_objInstance = new Division();
     }
     return self::$_objInstance;
 }
 public static function _manage_platoon($div, $plt)
 {
     $division = Division::findByName(strtolower($div));
     $platoonId = Platoon::getIdFromNumber($plt, $division->id);
     if (!is_null($platoonId)) {
         $user = User::find(intval($_SESSION['userid']));
         $member = Member::find(intval($_SESSION['memberid']));
         if ($member->platoon_id == $platoonId || $user->role > 2 || User::isDev()) {
             $tools = Tool::find_all($user->role);
             $divisions = Division::find_all();
             $platoon = Platoon::findById($platoonId);
             $unassignedMembers = Platoon::unassignedMembers($platoonId, true);
             $squads = Squad::findByPlatoonId($platoonId);
             $memberCount = count((array) Platoon::members($platoonId));
             $js = 'manage';
             Flight::render('manage/platoon', compact('division', 'platoon', 'squads', 'unassignedMembers', 'memberCount'), 'content');
             Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
         } else {
             // insufficient access
             Flight::redirect('404/', 404);
         }
     } else {
         // nonexistent platoon
         Flight::redirect('404/', 404);
     }
 }
Пример #9
0
 /**
  * Get every student that isnt inscripted in other division.
  * The inscription depends on the aproval method implemented by each school
  *
  * @param  Division     $division
  *
  * @return array Student[]
  */
 public function getAvailableStudentsForDivision(Division $division)
 {
     $students_in = array();
     foreach ($division->getCourses() as $course) {
         foreach ($course->getNonOptionCourseSubjects() as $course_subject) {
             $criteria_course = $this->getAvailableStudentsForCourseSubjectCriteria($course_subject);
             $criteria_course->clearSelectColumns();
             $criteria_course->addSelectColumn(StudentPeer::ID);
             $stmt = StudentPeer::doSelectStmt($criteria_course);
             $students_in = array_merge($stmt->fetchAll(PDO::FETCH_COLUMN), $students_in);
         }
     }
     $c = new Criteria();
     //$c->addAnd(StudentPeer::ID,$not_in,Criteria::NOT_IN);
     $c->add(StudentPeer::ID, $students_in, Criteria::IN);
     return StudentPeer::doSelect($c);
 }
 /**
  * @param $division_structure
  * @return string
  */
 private function getGeneralSergeants($division_structure)
 {
     $general_sergeants = Division::findGeneralSergeants($this->game_id);
     foreach ($general_sergeants as $general_sergeant) {
         $aod_url = Member::createAODlink(['member_id' => $general_sergeant->member_id, 'rank' => Rank::convert($general_sergeant->rank_id)->abbr, 'forum_name' => $general_sergeant->forum_name]);
         $division_structure .= "{$aod_url}\r\n";
     }
     return $division_structure;
 }
 /**
  * @param $division_structure
  * @return string
  */
 private function getDivisionLeaders($division_structure)
 {
     $division_leaders = Division::findDivisionLeaders($this->game_id);
     foreach ($division_leaders as $division_leader) {
         $aod_url = Member::createAODlink(['member_id' => $division_leader->member_id, 'rank' => Rank::convert($division_leader->rank_id)->abbr, 'forum_name' => $division_leader->forum_name]);
         $division_structure .= property_exists($division_leader, 'position_desc') ? "{$aod_url} - {$division_leader->position_desc}\r\n" : "{$aod_url}\r\n";
     }
     return $division_structure;
 }
Пример #12
0
function manage_division()
{
    global $wpdb;
    require_once 'controllers/manage-division.php';
    $table = new Division();
    $table->prepare_items();
    $message = '';
    if ('delete' === $table->current_action()) {
        $message = '<div class="updated below-h2" id="message"><p>' . sprintf(__('Items deleted: %d', 'policy_library_plugin'), count($_REQUEST['id'])) . '</p></div>';
    }
    ?>
<div class="wrap">

    <div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
    <h2><?php 
    _e('Divisions', 'policy_library_plugin');
    ?>
 <a class="add-new-h2"
                                 href="<?php 
    echo get_admin_url(get_current_blog_id(), 'admin.php?page=divisions_form');
    ?>
"><?php 
    _e('Add new', 'policy_library_plugin');
    ?>
</a>
    </h2>
    <?php 
    echo $message;
    ?>

    <form id="divisions-table" method="GET">
        <input type="hidden" name="page" value="<?php 
    echo $_REQUEST['page'];
    ?>
"/>
        <?php 
    $table->display();
    ?>
    </form>

</div>
<?php 
}
 public static function _help()
 {
     $user = User::find(intval($_SESSION['userid']));
     $member = Member::find(intval($_SESSION['memberid']));
     $tools = Tool::find_all($user->role);
     $divisions = Division::find_all();
     $division = Division::findById(intval($member->game_id));
     $js = 'help';
     Flight::render('application/help', compact('user', 'member', 'division'), 'content');
     Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
 }
Пример #14
0
 /**
  * 
  * @return Division[]
  */
 public function getDivList()
 {
     if ($this->_divList === FALSE) {
         if (($rec = $this->getRec()) != NULL) {
             $this->_divList = Division::model()->findAllByRecId($rec->id);
         } else {
             // FIXME null ??
             $this->_divList = array();
         }
     }
     return $this->_divList;
 }
 public static function _addNewMember()
 {
     $user = User::find(intval($_SESSION['userid']));
     $member = Member::find(intval($_SESSION['memberid']));
     $tools = Tool::find_all($user->role);
     $divisions = Division::find_all();
     $division = Division::findById(intval($member->game_id));
     $platoons = Platoon::find_all($member->game_id);
     $platoon_id = $user->role >= 2 && !User::isDev() ? $member->platoon_id : false;
     $squads = Squad::findAll($member->game_id, $platoon_id);
     $js = 'recruit';
     Flight::render('recruiting/new_member', compact('user', 'member', 'division', 'platoons', 'squads'), 'content');
     Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
 }
 public static function _authenticate()
 {
     if (User::isLoggedIn()) {
         $user = User::find(intval($_SESSION['userid']));
         $member = Member::find(intval($_SESSION['memberid']));
         $tools = Tool::find_all($user->role);
         $divisions = Division::find_all();
         Flight::render('layouts/auth', [], 'content');
         Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
     } else {
         Flight::render('layouts/auth', [], 'content');
         Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     // add your code here
     $courses = CoursePeer::doSelect(new Criteria());
     foreach ($courses as $course) {
         $division = new Division();
         $division->setName($course->getName());
         $division->setSchoolYearId($course->getSchoolYearId());
         foreach ($course->getCourseSubjects() as $course_subject) {
             $course_students = $course->getCourseStudents();
             if (isset($course_students[0])) {
                 $division->setCareerId($course_students[0]->getCareerSubject()->getCareerId());
             } else {
                 $division->setCareerId(1);
             }
             $new_course = new Course();
             $course->copyInto($new_course);
             $new_course->setName($course_subject->getSubject() . ' - ' . $course->getName());
             $new_course->save();
             $new_course_subject = new CourseSubject();
             $course_subject->copyInto($new_course_subject);
             $new_course_subject->setCourseId($new_course->getId());
             $new_course_subject->setCourseId($new_course->getId());
             $new_course_subject->save();
             $course_subject->delete();
             $c = new Criteria();
             $c->add(CourseStudentPeer::COURSE_ID, $course->getId());
             $c->addJoin(CourseStudentPeer::CAREER_SUBJECT_ID, CareerSubjectPeer::ID);
             $c->add(CareerSubjectPeer::SUBJECT_ID, $new_course_subject->getSubjectId());
             $course_students = CourseStudentPeer::doSelect($c);
             foreach ($course_students as $course_student) {
                 $new_course_student = new CourseStudent();
                 $course_student->copyInto($new_course_student);
                 $new_course_student->setCourseId($new_course->getId());
                 $new_course_student->save();
                 $course_student->delete();
             }
             $division_course = new DivisionCourse();
             $division_course->setCourse($new_course);
             $division->addDivisionCourse($division_course);
         }
         try {
             $course->delete();
         } catch (Exception $e) {
         }
         try {
             $division->save();
         } catch (Exception $e) {
         }
         $this->logSection('division+', 'Division ' . $division . ' created');
     }
 }
Пример #18
0
 public function load()
 {
     $this->clear();
     $division = new Division('D1');
     $level = $this->CI->_level->findOneBySlug('college');
     $division->setLevel($level);
     $league = $this->CI->_league->findOneBySlug('ncaa');
     $division->setLeague($league);
     $division->save();
     print_r(sprintf("Created Division: %s (%s)\n", $division->getName(), $division->getId()));
 }
 public static function _retentionNumbers()
 {
     $user = User::find(intval($_SESSION['userid']));
     if ($user->role >= 3 || User::isDev()) {
         $member = Member::find(intval($_SESSION['memberid']));
         $tools = Tool::find_all($user->role);
         $divisions = Division::find_all();
         $recruited = Report::recruitedLast30days($member->game_id);
         $removed = Report::removedLast30days($member->game_id);
         $monthlyBreakdown = Report::recruitingWeekly($member->game_id);
         $byTheMonth = Report::recruitingByTheMonth($member->game_id);
         $js = 'report';
         Flight::render('reports/retention', compact('recruited', 'removed', 'js', 'monthlyBreakdown', 'byTheMonth'), 'content');
         Flight::render('layouts/application', array('user' => $user, 'member' => $member, 'tools' => $tools, 'divisions' => $divisions));
     } else {
         Flight::redirect('/404', 404);
     }
 }
 public function __construct($user, $member)
 {
     // leadership notifications
     if ($user->role > 1) {
         // expired or pending leaves of absence
         if (LeaveOfAbsence::count_expired($member->game_id) > 0 || LeaveOfAbsence::count_pending($member->game_id) > 0) {
             array_push($this->messages, "<div class='alert alert-warning'><i class='fa fa-clock-o fa-lg'></i> There are leaves of absence that require your attention <a href='manage/leaves-of-absence' class='alert-link'>Manage Leaves of Absence</a></div>");
         }
     }
     // division CO / XO
     if ($user->role > 2) {
         if (count(Division::findUnassigned($member->game_id))) {
             array_push($this->messages, "<div class=\"alert alert-warning\"><i class=\"fa fa-exclamation-circle\"></i> Your division has unassigned members. Visit your division page to resolve this.</div>");
         }
     }
     if (!User::isValidated()) {
         array_push($this->messages, "<div class='alert alert-info'><i class='fa fa-envelope fa-lg'></i> Your account email has not been verified. <a href='#' class='alert-link send-email-validation' data-email='{$user->email}'>Send Validation</a></div>");
     }
 }
Пример #21
0
 public function actionDivision()
 {
     $divisions = Division::model()->findAllByRecId($this->rec->id);
     if (!O::app()->user->isGuest) {
         $userId = O::app()->user->id;
         $model = new DivisionChoiceForm('', $this->rec, $divisions);
         if (isset($_POST['DivisionChoiceForm'])) {
             $model->attributes = $_POST['DivisionChoiceForm'];
             if ($model->validate() && $model->save($userId)) {
                 //if ($this->isWizard) $this->redirect($this->getURL('form', array('wiz' => 1)));
                 if ($this->afterSave('form')) {
                     return;
                 }
                 //return;
             }
         } else {
             $model->setUserId($userId);
         }
         $this->render('division', array('divisions' => $divisions, 'model' => $model));
     } else {
         $this->render('division', array('divisions' => $divisions));
     }
 }
foreach($studModel as $list) {
$stud_info = StudentInfo::model()->findByAttributes(array('student_info_transaction_id'=>$list['student_transaction_id']));	
if($stud_info)
{
	$trans = StudentTransaction::model()->findByPk($stud_info->student_info_transaction_id); 
	$titl = "<b>".$stud_info->title."</b>";
	$name = "<b>".$stud_info->student_first_name." ".$stud_info->student_middle_name." ".$stud_info->student_last_name."</b>"; 
	$smobile = "<b>".$stud_info->student_mobile_no."</b>";
	$pmobile = "<b>".$stud_info->student_guardian_mobile."</b>";

	$branch_model=Branch::model()->findByPk($trans->student_transaction_branch_id);
	$en_no = "<b>".$stud_info->student_enroll_no."</b>";
	$branch = "<b>".$branch_model->branch_name."</b>";
	$sem = "<b>Sem-".AcademicTerm::model()->findByPk($trans->student_academic_term_name_id)->academic_term_name."</b>";
        if($trans->student_transaction_division_id != 0)
	$div = "<b>".Division::model()->findByPk($trans->student_transaction_division_id)->division_name."</b>";
	else
	$div = '-';
	$photos=StudentPhotos::model()->findByPk($trans->student_transaction_student_photos_id)->student_photos_path;
	$photo=CHtml::image(Yii::app()->request->baseUrl.'/college_data/stud_images/'.$photos,'image',array('width'=>120,'height'=>140,'class'=>'photo','style'=>'padding-right:0px;','border'=>1));
	$gender = "<b>".$stud_info->student_gender."</b>";
	$cdate = "<b>".date('d/m/Y')."</b>";
	if($trans->student_transaction_category_id !=0)
		$category = "<b>".Category::model()->findByPk($trans->student_transaction_category_id)->category_name."</b>";
	else 
		$category = "<b>not set</b>";
	$lin1 = "<b>not set</b>";
	$lin2 = "<b>not set</b>";
	$ct = "<b>not set</b>";
	$stat = "<b>not set</b>";
	$pc = "<b>not set</b>";
				
		                }')));
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'student_transaction_branch_id');
?>
	</div>
	
	<div class="row-right">
		<?php 
echo $form->labelEx($model, 'student_transaction_division_id');
?>
		<?php 
if (isset($model->student_transaction_division_id)) {
    echo $form->dropDownList($model, 'student_transaction_division_id', CHtml::listData(Division::model()->findAll(array('condition' => 'academic_name_id=' . $model->student_academic_term_name_id . ' and branch_id=' . $model->student_transaction_branch_id . ' and division_organization_id=' . $org_id)), 'division_id', 'division_code'), array('prompt' => '-----------Select-----------', 'tabindex' => 12, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/getStudbatch'), 'update' => '#StudentTransaction_student_transaction_batch_id')));
} else {
    echo $form->dropDownList($model, 'student_transaction_division_id', array(), array('prompt' => '-----------Select-----------', 'tabindex' => 12, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/getStudbatch'), 'update' => '#StudentTransaction_student_transaction_batch_id')));
}
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'student_transaction_division_id');
?>
	</div>

 </div>
 <div class="row">
	<div class="row-left">
        <?php 
echo $form->labelEx($model, 'student_transaction_batch_id');
 /**
  * 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 = Division::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public static function setAvailableStudentsForDivision(Division $division)
 {
     self::$_students = array_merge($division->getStudents(), SchoolBehaviourFactory::getInstance()->getAvailableStudentsForDivision($division, $filter_by_orientation = true));
 }
Пример #26
0
 public function actiongetelectivedivision()
 {
     $subject_id = $_REQUEST['ElectiveSubjectDetails']['elective_subject_id'];
     $subject_branch = SubjectMaster::model()->findByAttributes(array('subject_master_id' => $subject_id));
     $org_id = Yii::app()->user->getState('org_id');
     $data = array();
     $data = Division::model()->findAll(array('condition' => 'division_organization_id=' . $org_id . ' and branch_id=' . $subject_branch['subject_master_branch_id'] . ' and academic_name_id=' . $subject_branch['subject_master_academic_terms_name_id']));
     $data = CHtml::listData($data, 'division_id', 'division_code');
     echo "<option value=''>Select Division</option>";
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
Пример #27
0
			<?php 
        echo CHtml::image(Yii::app()->baseUrl . "/college_data/stud_images/" . $studphoto, "no-images", array("width" => "60px", "height" => "60px"));
        ?>
		</div>
		<div class="contentinfo">
		
		<?php 
        foreach ($selected_list as $key => $value) {
            if ($key == 'quota_name') {
                $field_value = Quota::model()->findByPk($stud['student_transaction_quota_id'])->quota_name;
            } else {
                if ($key == 'branch_name') {
                    $field_value = Branch::model()->findByPk($stud['student_transaction_branch_id'])->branch_name;
                } else {
                    if ($key == 'division_code') {
                        $field_value = Division::model()->findByPk($stud['student_transaction_division_id'])->{$key};
                    } else {
                        if ($key == 'sem') {
                            $field_value = AcademicTerm::model()->findByPk($stud['student_academic_term_name_id'])->academic_term_name;
                        } else {
                            if ($key == 'student_first_name') {
                                $lname = $StudentInfo->student_last_name;
                                $fname = $StudentInfo->student_first_name;
                                $mname = $StudentInfo->student_middle_name;
                                $label = $value;
                                $field_value = $lname . " " . $fname . " " . $mname;
                            } else {
                                $field_value = $stud[$key];
                            }
                        }
                    }
    protected function renderContent()
    {
        $day = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
        if (Yii::app()->user->getState('stud_id')) {
            $date = date('Y-m-d');
            $ts = strtotime($date);
            $week_number = date('W', $ts);
            $year = date('Y');
            for ($day1 = 1; $day1 < 7; $day1++) {
                $alldate[] = date('d-m-Y', strtotime($year . "W" . $week_number . $day1));
            }
            $criteria = new CDbCriteria();
            //$criteria->select = 'academic_term_id'; // select fields which you want in output
            $criteria->condition = 'current_sem = 1 AND academic_term_organization_id = ' . Yii::app()->user->getState('org_id');
            $semname = AcademicTerm::model()->findAll($criteria);
            $data = CHtml::listData($semname, 'academic_term_id', 'academic_term_id');
            $stud_model = StudentTransaction::model()->findByPk(Yii::app()->user->getState('stud_id'));
            $check_sem = in_array($stud_model->student_academic_term_name_id, $data);
            //var_dump($check_sem); exit;
            $timetableid = 0;
            if (!$check_sem) {
                echo "<h3 align=center style=color:red>Sorry, No timetable available for this student.</h3>";
            } else {
                $check_timetable = TimeTableDetail::model()->findByAttributes(array('acdm_name_id' => $stud_model->student_academic_term_name_id, 'division_id' => $stud_model->student_transaction_division_id));
                if (empty($check_timetable)) {
                    echo "<h3 align=center style=color:red>Sorry, No timetable available for this student.</h3>";
                } else {
                    $timetableid = $check_timetable->timetable_id;
                    $model = TimeTable::model()->findByPk($timetableid);
                    $nooflec = $model->No_of_Lec;
                    $sum = $nooflec;
                    $lec_duration = LecDuration::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id ', $params = array(':table_id' => $timetableid));
                    $lec = array();
                    foreach ($lec_duration as $l) {
                        $lec[] = $l['duration'];
                    }
                    $createdate = date_create($model->creation_date);
                    $starti = 1;
                    if ($model->zero_lec == 1) {
                        $starti = 0;
                    }
                    $time = $model->clg_start_time;
                    $time = date('H:i A', strtotime($time));
                    $timestamp = strtotime($time);
                    $time = date('g:i A', $timestamp);
                    ?>

			<table id="time-table-struc" bgcolor="#CBE7ED"  border="2" style= width:auto;font-size:8px;border-collapse:collapse; height:auto;"  align="center">
			<th  align=center>
				Day/Time
			</th>

<?php 
                    $i = 0;
                    while ($i < 6) {
                        echo "<th>" . $day[$i] . "</br>(" . $alldate[$i] . ")</th>";
                        $i++;
                    }
                    $break = "";
                    $l = 0;
                    $count = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0);
                    for ($i = $starti; $i <= $nooflec; $i++) {
                        $days = count($day);
                        echo "<tr>";
                        $duration = NoOfBreakTable::model()->findByAttributes(array('timetable_id' => $timetableid, 'after_lec_break' => $i));
                        $dur = $duration['duration'];
                        if ($dur) {
                            $dur1 = date('i', strtotime($dur));
                        }
                        if ($break) {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + $dur1 * 60) . "</td><td colspan=7 align=center><font color='green'><b>Break</b></font></td></tr>";
                            $break = "";
                            $timestamp = strtotime($time) + $dur1 * 60;
                            $time = date('g:i A', $timestamp);
                            $i--;
                            continue;
                        } else {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + 60 * $lec[$l]) . "</td>";
                            $timestamp = strtotime($time) + 60 * $lec[$l];
                            $l++;
                            $time = date('g:i A', $timestamp);
                        }
                        for ($j = 1; $j <= $days; ++$j) {
                            $subname = "";
                            $room = "";
                            $faculty = "";
                            $batch = "";
                            if ($count[$j] > 0) {
                                $count[$j]--;
                                continue;
                            }
                            $result = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id AND day = :day AND lec = :lec AND division_id = :div_id AND lecture_date = :lecdate and proxy_status <> :proxy_status', $params = array(':table_id' => $timetableid, ':day' => $j, ':lec' => $i, ':div_id' => $stud_model->student_transaction_division_id, ':lecdate' => date('Y-m-d', strtotime($alldate[$j - 1])), ':proxy_status' => 2));
                            $break = NoOfBreakTable::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id  AND after_lec_break = :lec', $params = array(':table_id' => $timetableid, ':lec' => $i));
                            if ($result) {
                                foreach ($result as $list) {
                                    if ($list['lect_hour'] > 1) {
                                        $count[$j] = $list['lect_hour'] - 1;
                                    }
                                    echo "<td rowspan=" . $list['lect_hour'] . " align=center style=background:#C0CCCC; width:100px;>";
                                    break;
                                }
                                foreach ($result as $check) {
                                    if ($check->batch_id != 0) {
                                        $batch = "(" . Batch::model()->findByPk($check->batch_id)->batch_name . ")";
                                    }
                                    $subname = SubjectMaster::model()->findByPk($check->subject_id)->subject_master_alias;
                                    $room = "(" . RoomDetailsMaster::model()->findByPk($check->room_id)->room_name . ")";
                                    $faculty = "(" . EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $check->faculty_emp_id))->employee_name_alias . ")";
                                    if ($batch) {
                                        echo "</br>" . $subname . "</br>" . $batch . "</br>" . $room . "</br>" . $faculty;
                                    } else {
                                        echo "</br>" . $subname . "</br>" . $room . "</br>" . $faculty;
                                    }
                                }
                                echo "</td>";
                            } else {
                                echo "<td style=width:100px;>" . $subname . "</br>" . $batch . "</br>" . $room . "</br>" . $faculty . "</td>";
                            }
                        }
                        echo "</tr>";
                    }
                    echo "</table>";
                    ?>
<h5>Proxy details</h5>

<table id="time-table-struc" style="font-size:10px;">
<tr>
<th>Sr. No.</th>
<th>Employee Name</th>
<th>Proxy Employee Name</th>
<th>Subject</th>
<th>Lecture No.</th>
<th>Date</th>
</tr>
<?php 
                    $proxy_data = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'timetable_id = :timetable_id and division_id = :div_id and lecture_date >= :start and lecture_date< :end and proxy_status = :proxy order by lec', $params = array(':timetable_id' => $timetableid, ':div_id' => $stud_model->student_transaction_division_id, ':start' => date('Y-m-d', strtotime($alldate[0])), ':end' => date('Y-m-d', strtotime($alldate[5])), ':proxy' => 1));
                    $n = 0;
                    foreach ($proxy_data as $list) {
                        $result = TimeTableDetail::model()->findByPk($list->proxy_id);
                        ?>

<tr>
<td><?php 
                        echo ++$n;
                        ?>
</td>
<td><?php 
                        echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $list->faculty_emp_id))->employee_first_name;
                        ?>
</td>
<td><?php 
                        echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $result->faculty_emp_id))->employee_first_name;
                        ?>
</td>
<td><?php 
                        echo SubjectMaster::model()->findByPk($result->subject_id)->subject_master_alias;
                        ?>
</td>
<td><?php 
                        echo $result->lec;
                        ?>
</td>
<td><?php 
                        echo date('d-m-Y', strtotime($result->lecture_date));
                        ?>
</td>
</tr>
<?php 
                    }
                    ?>
</table>
<?php 
                }
                //ELSE END
            }
        } else {
            if (Yii::app()->user->getState('emp_id')) {
                $timetableid = 0;
                $date = date('Y-m-d');
                $ts = strtotime($date);
                $week_number = date('W', $ts);
                $alldate[0] = 'No';
                $year = date('Y');
                for ($day2 = 1; $day2 < 7; $day2++) {
                    $alldate[$day2] = date('d-m-Y', strtotime($year . "W" . $week_number . $day2));
                }
                $semname = AcademicTerm::model()->findAllByAttributes(array(), $condition = 'current_sem = :current_sem and academic_term_organization_id=:org_id', $params = array(':current_sem' => 1, ':org_id' => Yii::app()->user->getState('org_id')));
                foreach ($semname as $s) {
                    $semid = $s['academic_term_id'];
                    $check = TimeTableDetail::model()->findByAttributes(array('acdm_name_id' => $semid, 'faculty_emp_id' => Yii::app()->user->getState('emp_id')));
                    if ($check) {
                        $timetableid = $check['timetable_id'];
                        break;
                    }
                }
                if (!empty($timetableid)) {
                    $day = array(" ", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
                    $model = TimeTable::model()->findByPk($timetableid);
                    $nooflec = $model->No_of_Lec;
                    $sum = $nooflec;
                    $lec_duration = LecDuration::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id ', $params = array(':table_id' => $timetableid));
                    $lec = array();
                    foreach ($lec_duration as $l) {
                        $lec[] = $l['duration'];
                    }
                    $starti = 1;
                    if ($model->zero_lec == 1) {
                        $starti = 0;
                    }
                    $time = $model->clg_start_time;
                    $time = date('H:i A', strtotime($time));
                    $createdate = date_create($model->creation_date);
                    ?>

			<table id="time-table-struc" bgcolor="#CBE7ED" border="2" style="width:auto;font-size:9px;border-collapse:collapse; height:auto;" >
			<th>
				Day/Time
			</th>

			<?php 
                    $i = 0;
                    while ($i < 7) {
                        echo "<th style='font-size:8px'>" . $day[$i] . "</br>(" . $alldate[$i] . ")</th>";
                        $i++;
                    }
                    $l = 0;
                    $break = "";
                    $dur1 = 0;
                    $count = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0);
                    for ($i = $starti; $i <= $nooflec; $i++) {
                        $days = count($day);
                        echo "<tr>";
                        $duration = NoOfBreakTable::model()->findByAttributes(array('timetable_id' => $timetableid, 'after_lec_break' => $i));
                        if ($duration) {
                            $dur = $duration['duration'];
                            $dur1 = date('i', strtotime($dur));
                        }
                        if ($break) {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + $dur1 * 60) . "</td><td colspan=7 align=center ><font color='green'><b>Break</b></font></td></tr>";
                            $break = "";
                            $timestamp = strtotime($time) + $dur1 * 60;
                            $time = date('g:i A', $timestamp);
                            $i--;
                            continue;
                        } else {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + 60 * $lec[$l]) . "</td><td style=width:25px;><b>" . $i . "</b></td>";
                            $timestamp = strtotime($time) + 60 * $lec[$l];
                            $l++;
                            $time = date('g:i A', $timestamp);
                        }
                        for ($j = 1; $j <= $days - 1; ++$j) {
                            $subname = "";
                            $room = "";
                            $faculty = "";
                            $batch = "";
                            if ($count[$j] > 0) {
                                $count[$j]--;
                                continue;
                            }
                            $result = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'day = :day AND lec = :lec AND faculty_emp_id = :emp_id AND timetable_id=:table_id AND lecture_date =:lecdate and proxy_status <> :status', $params = array(':table_id' => $timetableid, ':day' => $j, ':lec' => $i, ':emp_id' => Yii::app()->user->getState('emp_id'), ':lecdate' => date('Y-m-d', strtotime($alldate[$j])), ':status' => 2));
                            $break = NoOfBreakTable::model()->findAllByAttributes(array(), $condition = 'after_lec_break = :lec AND timetable_id=:table_id', $params = array(':table_id' => $timetableid, ':lec' => $i));
                            if ($result) {
                                foreach ($result as $list) {
                                    if ($list['lect_hour'] > 1) {
                                        $count[$j] = $list['lect_hour'] - 1;
                                    }
                                    echo "<td rowspan=" . $list['lect_hour'] . " align=center style=background:#C0CCCC; border-color:black; width:150px;>";
                                    break;
                                }
                                foreach ($result as $check) {
                                    if ($check->batch_id != 0) {
                                        $batch = "(" . Batch::model()->findByPk($check->batch_id)->batch_name . ")";
                                    }
                                    $subname = SubjectMaster::model()->findByPk($check->subject_id)->subject_master_alias;
                                    $room = "(" . RoomDetailsMaster::model()->findByPk($check->room_id)->room_name . ")";
                                    $div = Division::model()->findByPk($check->division_id)->division_code;
                                    //$faculty="(".EmployeeInfo::model()->findByPk($check->faculty_emp_id)->employee_name_alias.")";
                                    if ($batch) {
                                        echo $subname . "</br>" . $batch . "</br>" . $room;
                                    } else {
                                        echo $subname . "</br>" . "(" . $div . ")" . "</br>" . $room;
                                    }
                                }
                                echo "</td>";
                            } else {
                                echo "<td style=width:150px;>" . $subname . "</br>" . $batch . "</br>" . $room . "</td>";
                            }
                        }
                        //for j end
                        echo "</tr>";
                    }
                    //for i end
                    echo "</table>";
                    ?>
<h5>Proxy Lectures</h5>

<table id="time-table-struc" border="1" style="font-size:10px;">
<tr>
<th>Sr. No.</th>
<th>Employee Name</th>
<th>Division</th>
<th>Subject</th>
<th>Room</th>
<th>Lecture No.</th>
<th>Date</th>
</tr>
<?php 
                    $proxy_data = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'timetable_id = :timetable_id and proxy_employee_id = :emp_id and lecture_date >= :start and lecture_date< :end and proxy_status = :proxy order by lec', $params = array(':timetable_id' => $timetableid, ':emp_id' => Yii::app()->user->getState('emp_id'), ':start' => date('Y-m-d', strtotime($alldate[0])), ':end' => date('Y-m-d', strtotime($alldate[5])), ':proxy' => 1));
                    $n = 0;
                    foreach ($proxy_data as $list) {
                        $result = TimeTableDetail::model()->findByPk($list->proxy_id);
                        ?>

<tr>
<td><?php 
                        echo ++$n;
                        ?>
</td>
<td><?php 
                        echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $list->faculty_emp_id))->employee_first_name;
                        ?>
</td>
<td><?php 
                        echo Division::model()->findByPk($result->division_id)->division_code;
                        ?>
</td>
<td><?php 
                        echo SubjectMaster::model()->findByPk($result->subject_id)->subject_master_alias;
                        ?>
</td>
<td><?php 
                        echo RoomDetailsMaster::model()->findByPk($result->room_id)->room_name;
                        ?>
</td>
<td><?php 
                        echo $result->lec;
                        ?>
</td>
<td><?php 
                        echo date('d-m-Y', strtotime($result->lecture_date));
                        ?>
</td>
</tr>
<?php 
                    }
                    ?>
</table>		

<?php 
                } else {
                    echo "<h3 align=center style=color:red>Sorry, No timetable available.</h3>";
                }
            }
        }
    }
<th>Receipt No</th>
<th>Amount</th>
</tr>


<?php 
    foreach ($var as $list) {
        $stud_data = StudentTransaction::model()->findByPk($list['fees_student_id']);
        echo '<tr><td>' . $i . '</td>';
        echo '<td>' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_enroll_no . '</td>';
        echo '<td>' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_roll_no . '</td>';
        echo '<td>' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_first_name . ' ' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_middle_name . ' ' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_last_name . '</td>';
        echo '<td>' . Branch::model()->findByPk($stud_data->student_transaction_branch_id)->branch_name . '</td>';
        echo '<td>' . AcademicTerm::model()->findByPk($stud_data->student_academic_term_name_id)->academic_term_name . '</td>';
        echo '<td>' . AcademicTermPeriod::model()->findByPk($stud_data->student_academic_term_period_tran_id)->academic_term_period . '</td>';
        echo '<td>' . Division::model()->findByPk($stud_data->student_transaction_division_id)->division_name . '</td>';
        echo '<td>' . $list['fees_received_date'] . '</td>';
        $rec_no = FeesReceipt::model()->findByPk($list['fees_receipt_id'])->fees_receipt_number;
        if ($list['fees_payment_method_id'] == '1') {
            $cash_id = $list['fees_payment_cash_cheque_id'];
            $amunt = FeesPaymentCash::model()->findByPk($cash_id)->fees_payment_cash_amount;
            $final_total += $amunt;
            $type = "Cash";
            echo '<td>' . $type . '</td>';
            echo '<td>-</td>';
            echo '<td>-</td>';
            echo '<td>' . $rec_no . '</td>';
            echo '<td>' . $amunt . '</td>';
        } else {
            $cheque_id = $list['fees_payment_cash_cheque_id'];
            $cheque_status = "Return cheque";
Пример #30
0
echo $form->error($model, 'branch_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'div_id');
?>
		<?php 
//echo $form->textField($model,'div_id');
?>
		<?php 
//echo $form->dropDownList($model,'div_id', CHtml::listData(Division::model()->findAll(), 'division_id', 'division_name'));
?>
		<?php 
echo $form->dropDownList($model, 'div_id', Division::items(), array('empty' => '---------------Select-------------', 'tabindex' => 5));
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'div_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'sub_id');
?>
		<?php 
//echo $form->textField($model,'sub_id');
?>
		<?php