<span class="btn btn-info"></span> <span class="btn btn-warning"></span> <span class="btn btn-danger"></span> </div> </div><!-- #sidebar-shortcuts --> <ul class="nav nav-list my-nav"> <li><a href="<?php echo Yii::app()->createUrl('admin/default/index'); ?> "><i class="icon-dashboard"></i><span class="menu-text"> <?php echo Lang::t('Dashboard'); ?> </span></a></li> <?php $this->renderPartial('application.views.contributionsByMembers._sideLinks'); $officio = Maofficio::model()->officio(); if (!empty($officio)) { $this->renderPartial('application.modules.users.views.default._sideLinks'); } ?> </ul><!-- /.nav-list --> <div class="sidebar-collapse" id="sidebar-collapse"> <i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i> </div> <?php } ?> </div>
/** * Search respective loan applications according to user authority * * @return type */ public function applications() { $id = Yii::app()->user->id; $cri = new CDbCriteria(); $currentChairman = Maofficio::model()->returnCurrentPostHolder(1); if (!empty($currentChairman) && $currentChairman->member == $id) { $cri->condition = "status='Pending' && forwarded_by_secretary!='Pending' && secretary_date IS NOT NULL && forwarded_by_treasurer!='Pending' && treasurer_date IS NOT NULL"; } else { $currentSecretary = Maofficio::model()->returnCurrentPostHolder(2); if (!empty($currentSecretary) && $currentSecretary->member == $id) { $cri->condition = "status='Pending' && forwarded_by_treasurer='Pending' && treasurer_date IS NULL && approved_by_chairman='Pending' && chairman_date IS NULL"; } else { $currentTreasurer = Maofficio::model()->returnCurrentPostHolder(3); if (!empty($currentTreasurer) && $currentTreasurer->member == $id) { $cri->condition = "status='Pending' && forwarded_by_secretary!='Pending' && secretary_date IS NOT NULL && approved_by_chairman='Pending' && chairman_date IS NULL"; } } } $cri->order = 'secretary_date DESC, treasurer_date DESC, chairman_date DESC, id ASC'; return MemberWithdrawal::model()->findAll($cri); }
/** * Establish authority of current user * * @return string */ public function officio() { $id = Yii::app()->user->id; $currentChairman = Maofficio::model()->returnCurrentPostHolder(1); if (!empty($currentChairman) && $currentChairman->member == $id) { return 'chairman'; } $currentSecretary = Maofficio::model()->returnCurrentPostHolder(2); if (!empty($currentSecretary) && $currentSecretary->member == $id) { return 'secretary'; } $currentTreasurer = Maofficio::model()->returnCurrentPostHolder(3); if (!empty($currentTreasurer) && $currentTreasurer->member == $id) { return 'treasurer'; } }
</a> </li> <?php } ?> <?php $currentChairman = Maofficio::model()->returnCurrentPostHolder(1); if (!empty($currentChairman) && $currentChairman->member == $id) { $model = MemberWithdrawal::model()->find("status='Pending' && forwarded_by_secretary!='Pending' && secretary_date IS NOT NULL && forwarded_by_treasurer!='Pending' && treasurer_date IS NOT NULL"); } else { $currentSecretary = Maofficio::model()->returnCurrentPostHolder(2); if (!empty($currentSecretary) && $currentSecretary->member == $id) { $model = MemberWithdrawal::model()->find("status='Pending' && forwarded_by_treasurer='Pending' && treasurer_date IS NULL && approved_by_chairman='Pending' && chairman_date IS NULL"); } else { $currentTreasurer = Maofficio::model()->returnCurrentPostHolder(3); if (!empty($currentTreasurer) && $currentTreasurer->member == $id) { $model = MemberWithdrawal::model()->find("status='Pending' && forwarded_by_secretary!='Pending' && secretary_date IS NOT NULL && approved_by_chairman='Pending' && chairman_date IS NULL"); } } } if (!empty($model)) { ?> <li class="<?php echo isset($_REQUEST['active']) && $_REQUEST['active'] == 'rurwa' ? 'active' : ''; ?> "> <a <?php if (isset($_REQUEST['active']) && $_REQUEST['active'] == 'rurwa') { ?>
<?php if (Maofficio::model()->officio() == 'treasurer') { ?> <li class="<?php echo isset($_REQUEST['active']) && $_REQUEST['active'] == 'kula' ? 'active' : ''; ?> "> <a <?php if (isset($_REQUEST['active']) && $_REQUEST['active'] == 'kula') { ?> <?php } else { ?> href="<?php echo Yii::app()->createUrl('/expenditures/create', array('active' => 'kula')); ?> " <?php } ?> > <i class="icon-suitcase"></i> <span class="menu-text"> <?php echo Lang::t('Cash Transactions'); ?> </span> </a> </li>
</li> <?php } ?> <?php $currentTreasurer = Maofficio::model()->returnCurrentPostHolder(3); if (!empty($currentTreasurer) && $currentTreasurer->member == $id) { $model = CashWithdrawals::model()->find("effected_by_treasurer!='Yes' && received_by_secretary='Yes' && secretary_date IS NOT NULL && approved_by_chairman='Yes' && chairman_date IS NOT NULL"); } else { $currentSecretary = Maofficio::model()->returnCurrentPostHolder(2); if (!empty($currentSecretary) && $currentSecretary->member == $id) { $model = CashWithdrawals::model()->find("approved_by_chairman='Pending' && chairman_date IS NULL && effected_by_treasurer='Pending' && treasurer_date IS NULL"); } else { $currentChairman = Maofficio::model()->returnCurrentPostHolder(1); if (!empty($currentChairman) && $currentChairman->member == $id) { $model = CashWithdrawals::model()->find("received_by_secretary='Yes' && secretary_date IS NOT NULL && effected_by_treasurer='Pending' && treasurer_date IS NULL"); } } } if (!empty($model)) { ?> <li class="<?php echo isset($_REQUEST['active']) && $_REQUEST['active'] == 'towachi' ? 'active' : ''; ?> "> <a <?php if (isset($_REQUEST['active']) && $_REQUEST['active'] == 'towachi') { ?>
/** * 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 $id the ID of the model to be loaded * @return Maofficio the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Maofficio::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Search respective loan applications according to user authority * * @return type */ public function applications() { $id = Yii::app()->user->id; $cri = new CDbCriteria(); $currentChairman = Maofficio::model()->returnCurrentPostHolder(1); if (!empty($currentChairman) && $currentChairman->member == $id) { $cri->condition = "witness>0 && (loan_type!=4 || (loan_type=4 && guarantor1>0 && guarantor2>0)) && forwarded_by_secretary!='Pending' && secretary_date IS NOT NULL && forwarded_by_treasurer!='Pending' && treasurer_date IS NOT NULL && closed!='Yes' && close_date IS NULL"; } else { $currentSecretary = Maofficio::model()->returnCurrentPostHolder(2); if (!empty($currentSecretary) && $currentSecretary->member == $id) { $cri->condition = "witness>0 && (loan_type!=4 || (loan_type=4 && guarantor1>0 && guarantor2>0)) && forwarded_by_treasurer='Pending' && treasurer_date IS NULL && approved_by_chairman='Pending' && chairman_date IS NULL && closed!='Yes' && close_date IS NULL"; } else { $currentTreasurer = Maofficio::model()->returnCurrentPostHolder(3); if (!empty($currentTreasurer) && $currentTreasurer->member == $id) { $cri->condition = "witness>0 && (loan_type!=4 || (loan_type=4 && guarantor1>0 && guarantor2>0)) && forwarded_by_secretary!='Pending' && secretary_date IS NOT NULL && approved_by_chairman='Pending' && chairman_date IS NULL && closed!='Yes' && close_date IS NULL"; } } } $cri->order = 'witness_date DESC, secretary_date DESC, guarantor1_date DESC, guarantor2_date DESC, treasurer_date DESC, chairman_date DESC, loan_type ASC, id ASC'; return LoanApplications::model()->findAll($cri); }