12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- /**
- * @author darkredz
- */
- class HolidayController extends DooController {
- public $staff;
- public static $NEW = 0;
- public static $NEW2 = 0;
- function __construct() {
- if(isset($_COOKIE["staff"])){
- if(!empty($_COOKIE["staff"])){
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- $this->staff=$staff->getUserByIdList($_COOKIE["staff"]);
- self::$NEW= $this->getReceiptCount();
- self::$NEW2= $this->getExeCount();
- include './protected/controller/ReceiptController.php';
- ReceiptController::$NEW=self::$NEW;
- ReceiptController::$NEW2=self::$NEW2;
- return "/";
- }
- }
- Doo::loadCore ( 'uri/DooUriRouter' );
- $router = new DooUriRouter ();
- $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
- if($routeRs['1']!="login"){
- header ( 'Content-Type:text/html;charset=utf-8' );
- @header ( "Location: /login" );
- }
- }
- public function myList(){
- $data ['memu'] = 'holiday';
- $data ['holidaymenu'] = 'mylist';
- $data ['staff'] = $this->staff;
- $this->render ( "/holiday-myList", $data );
- }
- private function getReceiptCount(){
- $status=2;
- $year=date('Y');
- Doo::loadModel('receipt');
- $receipt=new receipt();
- $dateCondition=" and Year(date) =".$year;
- $approvalCondition=' and nowStaff like "%'.$this->staff[0]['sid'].'%" ';
- $receiptList=$receipt->find(array('where'=>' status='.$status.$dateCondition.$approvalCondition,'desc'=>'rid','asArray'=>true));
- return count($receiptList);
- }
- private function getExeCount(){
- Doo::loadModel('receipt');
- $receipt=new receipt();
- $receiptList=$receipt->find(array('where'=>'(executeCopy like \'%["'.$this->staff[0]['sid'].'%\' and executeStaff NOT LIKE \'%'.$this->staff[0]['sid'].'%\' ) and (status=1 or status=6)','desc'=>'rid','asArray'=>true));
- return count($receiptList);
- }
- }
- ?>
|