public function accessCheck()
 {
     $da = $this->get("we_data_access");
     $da_im = $this->get('we_data_access_im');
     $request = $this->getRequest();
     //访问权限校验
     $api = new ApiController();
     $api->setContainer($this->container);
     $isWeFaFaDomain = $api->checkWWWDomain();
     if (!$isWeFaFaDomain) {
         $token = $api->checkAccessToken($request, $da);
         if (!$token) {
             $re = array("returncode" => "9999");
             $re["code"] = "err0105";
             $re["msg"] = "参数Appid或Openid或Access_token未指定或无效.";
             return $re;
         }
     }
     $openid = $request->get("openid");
     $staffinfo = new Staff($da, $da_im, $openid, $this->get("logger"), $this->container);
     $staffdata = $staffinfo->getInfo();
     if (empty($staffdata)) {
         return Utils::WrapResultError("无效操作帐号");
     }
     return Utils::WrapResultOk($staffinfo);
 }
Example #2
0
 public function daftarPekerjaPost2()
 {
     if (Request::ajax()) {
         $data = Input::all();
         $noPekerja_ = 10000;
         $noPekerja = DB::table('staff')->where('noPekerja', '>=', 10000)->orderBy('noPekerja', 'desc')->first();
         //            dd($noPekerja);
         if (isset($noPekerja)) {
             $noPekerja_ = $noPekerja->noPekerja + 1;
         }
         //            dd($noPekerja_);
         $staff = new Staff();
         $staff->noPekerja = $noPekerja_;
         $staff->nama = $data['nama'];
         $staff->noKP = $data['noKP'];
         $staff->jawatan = $data['jawatan'];
         $staff->penempatan = $data['penempatan'];
         $staff->bahagian = $data['bahagian'];
         $staff->cawangan = $data['cawangan'];
         $staff->noPhone = $data['noPhone'];
         $staff->status = $data['status'];
         $staff->catatan = $data['catatan'];
         if ($staff->save()) {
             return $noPekerja_;
         } else {
             return $noPekerja_;
         }
     }
 }
Example #3
0
 function testCreatePair()
 {
     $staff_1 = new Staff();
     $staff_1->set(array('first_name' => 'First', 'last_name' => 'User'));
     $staff_1->save();
     $staff_2 = new Staff();
     $staff_2->set(array('first_name' => 'Second', 'last_name' => 'User'));
     $staff_2->save();
     $h = new Hour();
     $h->set(array('hours' => 6, 'staff_id' => $staff_1->id, 'pair_id' => $staff_2->id));
     $h->updateOrCreateWithPair();
     $this->assertTrue($h->id, 'should have an id');
     $this->assertTrue($h->get('pair_hour_id'), 'should have a pair hour id');
     $h2 = $h->getPairHour();
     $this->assertIsA($h2, 'Hour');
     $this->assertTrue($h2->id, 'should have an hour id');
     $this->assertEqual($h2->get('hours'), 6);
     $h->set(array('hours' => 7));
     $h->updateOrCreateWithPair();
     $h3 = $h->getPairHour();
     $this->assertEqual($h2->id, $h3->id);
     $this->assertEqual($h3->get('hours'), 7);
     $this->assertEqual($h3->getPairName(), $staff_1->getName());
     $this->assertEqual($h->getPairName(), $staff_2->getName());
 }
Example #4
0
 function approve($id)
 {
     if ($_POST) {
         $rs = new Staff($id);
         $rs->from_array($_POST);
         $rs->save();
     }
 }
Example #5
0
 function list_drop()
 {
     $staff = new Staff();
     $staff->get();
     foreach ($staff as $row) {
         $data[''] = '[ Staffs ]';
         $data[$row->staff_id] = $row->staff_name;
     }
     return $data;
 }
Example #6
0
 public function index()
 {
     $staff = new Staff();
     $data['q'] = $this->input->get('q');
     $data['title'] = 'Payroll';
     $data['results'] = $data['q'] == '' ? '' : 'Search result for "' . $this->input->get('q') . '"';
     if ($data['q'] != '') {
         $rs = $staff->or_like('staff_name', '%' . $data['q'] . '%')->or_like('staff_cabang', '%' . $data['q'] . '%')->or_like('staff_departement', '%' . $data['q'] . '%')->or_like('staff_jabatan', '%' . $data['q'] . '%');
     }
     $data['search_list'] = $staff->get();
     $this->load->view('searches', $data);
 }
Example #7
0
 function find_by_page($page = 1)
 {
     $limit = get_config('staffs.per_page');
     $offset = ($page - 1) * $limit;
     $staffs = Staff::find('all', array('order' => 'id desc', 'limit' => $limit, 'offset' => $offset));
     return $staffs;
 }
Example #8
0
 function getTeamLead()
 {
     if (!$this->lead && $this->getLeadId()) {
         $this->lead = Staff::lookup($this->getLeadId());
     }
     return $this->lead;
 }
 public function kemaskiniStaff()
 {
     if (Request::ajax()) {
         $data = Input::all();
         $noPekerja = $data['noPekerja'];
         $staff = Staff::find($noPekerja);
         $staff->nama = $data['nama'];
         $staff->noKP = $data['noKP'];
         $staff->jawatan = $data['jawatan'];
         $staff->penempatan = $data['penempatan'];
         $staff->bahagian = $data['bahagian'];
         $staff->cawangan = $data['cawangan'];
         $staff->sambungan = $data['sambungan'];
         $staff->faks = $data['faks'];
         $staff->speedDial = $data['speedDial'];
         $staff->status = $data['status'];
         $staff->catatan = $data['catatan'];
         if ($noPekerja == '3374') {
             $staff->noPhone .= '.';
             $staff->catatan = '';
             $staff->jawatan = 'PENOLONG PEGAWAI TEKNOLOGI MAKLUMAT (F29)';
             $staff->noKP = '**013002****';
             $staff->speedDial = '000';
         } else {
             $staff->noPhone = $data['noTel'];
         }
         if ($staff->save()) {
             return 'Save Succeeded';
         } else {
             return 'Failed to save';
         }
     }
 }
Example #10
0
 public static function GetStaff()
 {
     if (!self::Is_Set("sid") || !self::Is_Set("secret")) {
         return null;
     }
     return Staff::Load(self::GetStaffID());
 }
Example #11
0
 function getStaff()
 {
     if (!isset($this->_staff) && $this->staff_id) {
         $this->_staff = Staff::lookup($this->staff_id);
     }
     return $this->_staff;
 }
Example #12
0
 public function carian2($carian)
 {
     if (Request::ajax()) {
         if ($carian != '') {
             $users = Staff::where('nama', 'like', '%' . $carian . '%')->get();
             $count = 1;
             $output = '<table class="table table-striped table-bordered responsive">
                             <thead>
                             <tr>
                                 <th>Bil</th>
                                 <th>Nama</th>
                                 <th>Sambungan</th>
                                 <th>Speed Dial</th>
                                 <th>Jawatan</th>
                             </tr>
                             </thead>
                             <tbody>';
             foreach ($users as $user) {
                 $kemaskini = URL::route('staff-kemaskini') . '/' . $user->noPekerja;
                 $output .= '<tr>
                                     <td>' . $count++ . '</td>
                                     <td class="center"><b>' . $user->nama . '</b></td>
                                     <td class="center"><b>' . $user->sambungan . '</b></td>';
                 $speedDial = '';
                 if (strlen($user->speedDial) < 4) {
                     $speedDial = '# ' . $user->speedDial;
                 } else {
                     $speedDial = $user->speedDial;
                 }
                 $output .= '   <td class="center"><b>' . $speedDial . '</b></td>
                                     <td class="center"><b>' . $user->jawatan . '</b></td>
                                 </tr>';
             }
             $output .= '    </tbody>
                         </table>';
             if ($users->count() == 0) {
                 $output = '<table class="table table-striped table-bordered responsive">
                             <thead>
                             <tr>
                                 <th>Bil</th>
                                 <th>Nama</th>
                                 <th>No Telefon</th>
                                 <th>Speed Dial</th>
                                 <th>No Faks</th>
                                 <th>Alamat</th>
                             </tr>
                             </thead>
                             <tbody>
                             <tr>
                                     <td colspan="6"><font color="red">Tiada Maklumat</font></td>
                                 </tr>
                             </tbody>
                             </table>';
             }
             return $output;
         } else {
             return '';
         }
     }
 }
 public function configure()
 {
     $this->unsetTimestampable();
     if (!$this->getCurrentUser()->isSuperAdmin()) {
         $this->setDefault('staff_id', Staff::loggedIn());
     }
 }
Example #14
0
 public function getValidTimeLogTypes()
 {
     $staff_id = Staff::loggedInId();
     $table = Doctrine_Core::getTable('TimeLogType');
     $tlt = $this->getLastTimeLogTypeByStaffId($staff_id);
     $ci = $table->getClockInById($tlt);
     return $table->getByClockIn($ci);
 }
 public function AllStaff()
 {
     $params = $this->getRequest()->params();
     $teamURL = $params['team'];
     $teamURL = strtolower(str_replace('_', ' ', $teamURL));
     $staff = Staff::get()->filter('Team.Title', $teamURL);
     return $staff;
 }
Example #16
0
 public function configure()
 {
     $params = $this->getOption('params');
     $this->unsetTimeStampable();
     $this->setWidget('staff_id', new sfWidgetFormInputHidden());
     $this->setDefault('staff_id', Staff::loggedInId());
     $this->setDefault('task_id', $params['task_id']);
 }
Example #17
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if ($this->getUser()->isStaff()) {
         $this->staff = Staff::loggedIn();
     } else {
         $this->client = Client::loggedIn();
     }
 }
Example #18
0
 function sign_up()
 {
     // Staffs
     $staff = new Staff();
     $list_staff = $staff->list_drop();
     $staff_selected = '';
     $data['form_action'] = '';
     $data['staff_id'] = form_dropdown('staff_id', $list_staff, $staff_selected);
     // Role
     $role = new Role();
     $list_role = $role->list_drop();
     $role_selected = '';
     $data['role_id'] = form_dropdown('role_id', $list_role, $role_selected);
     $data['username'] = array('name' => 'username', 'placeholder' => 'Username', 'class' => 'input-block-level');
     $data['password'] = array('name' => 'password', 'placeholder' => 'password', 'class' => 'input-block-level');
     $data['btn_sign_up'] = array('name' => 'btn_sign_up', 'value' => 'Sign Up', 'class' => 'btn btn-primary btn-large');
     $this->load->view('users/sign_up', $data);
 }
Example #19
0
 public function actionIndex()
 {
     // $this->render('index', array(
     // 	'staff1' => $this->staff1,
     // 	'staff2' => $this->staff2,
     // 	'staff3' => $this->staff3
     // 	));
     $staff_member = Staff::model()->find('id=:id', array(':id' => 1));
     $this->render('index', array('staff member' => $staff_member));
 }
Example #20
0
 public function staff($id)
 {
     $staff = Staff::find($id);
     if ($staff->delete()) {
         Session::flash('success', 'Staff Berjaya dihapus.');
     } else {
         Session::flash('fail', 'Staff gagal dihapus');
     }
     //        return Session::get('success');
     return Redirect::to('admin/carian/staff');
 }
Example #21
0
 public function executeIndex(sfWebRequest $request)
 {
     $staffs = Staff::fetchAllIds();
     $tl = new TimeLog();
     foreach ($staffs as $staff) {
         $time_log = $tl->getLastByStaffId($staff['id']);
         if ($time_log) {
             $time_logs[] = $time_log;
         }
     }
     $this->time_logs = $time_logs;
 }
 public function UncategorizedStaff()
 {
     $uncategorizedstaffmembers = new ArrayList();
     $staffmembers = Staff::get();
     if ($staffmembers) {
         foreach ($staffmembers as $staff) {
             if ($staff->Category() == "Other") {
                 $uncategorizedstaffmembers->push($staff);
             }
         }
     }
     return $uncategorizedstaffmembers;
 }
Example #23
0
 public function configure()
 {
     $params = $this->getOption('params');
     $fromOptions = array('widget_name' => 'from', 'params' => $params, 'default_date' => '2008-01-01', 'default_time' => '12:00 AM');
     $untilOptions = array('widget_name' => 'until', 'params' => $params, 'default_date' => date('Y-m-d'), 'default_time' => date('h:i A'));
     $this->setWidgets(array('staff_id' => new sfWidgetFormDoctrineChoice(array('label' => 'Employee', 'model' => 'Staff', 'add_empty' => false)), 'from' => new sfJQueryDateTimeWidget($fromOptions), 'until' => new sfJQueryDateTimeWidget($untilOptions)));
     $this->setValidators(array('from' => new sfJQueryDateTimeValidator(array('widget_name' => 'from')), 'until' => new sfJQueryDateTimeValidator(array('widget_name' => 'until'))));
     if (@$params['staff_id']) {
         $this->setDefault('staff_id', $params['staff_id']);
     } else {
         $this->setDefault('staff_id', Staff::loggedInId());
     }
 }
 function fetchStaff()
 {
     $array = $this->_conn->fetchRow();
     if ($array == false) {
         return false;
     }
     $staff = new Staff();
     $staff->setUserid($array["userid"]);
     $staff->setLastName($array["last_name"]);
     $staff->setFirstName($array["first_name"]);
     $staff->setUsername($array["username"]);
     if ($array["circ_flg"] == "Y") {
         $staff->setCircAuth(true);
     } else {
         $staff->setCircAuth(false);
     }
     if ($array["circ_mbr_flg"] == "Y") {
         $staff->setCircMbrAuth(TRUE);
     } else {
         $staff->setCircMbrAuth(FALSE);
     }
     if ($array["catalog_flg"] == "Y") {
         $staff->setCatalogAuth(true);
     } else {
         $staff->setCatalogAuth(false);
     }
     if ($array["admin_flg"] == "Y") {
         $staff->setAdminAuth(true);
     } else {
         $staff->setAdminAuth(false);
     }
     if ($array["reports_flg"] == "Y") {
         $staff->setReportsAuth(TRUE);
     } else {
         $staff->setReportsAuth(FALSE);
     }
     if ($array["suspended_flg"] == "Y") {
         $staff->setSuspended(true);
     } else {
         $staff->setSuspended(false);
     }
     return $staff;
 }
Example #25
0
 public function configure()
 {
     $this->unsetTimeStampable();
     $this->setDefault('staff_id', Staff::loggedInId());
     if (!$this->getCurrentUser()->isSuperAdmin()) {
         $staff_input = new sfWidgetFormInputHidden();
         $this->setWidget('staff_id', $staff_input);
     }
     $params = $this->getOption('params');
     $options = array('widget_name' => 'time', 'params' => $params, 'default_date' => date('Y-m-d'), 'default_time' => date('h:i A'));
     $this->setWidget('time_log_type_id', new sfWidgetFormDoctrineChoice(array('model' => 'TimeLog', 'table_method' => 'getValidTimeLogTypes'), array()));
     $this->setWidget('time', new sfJQueryDateTimeWidget($options));
     $this->setValidator('time', new sfJQueryDateTimeValidator(array('widget_name' => 'time')));
 }
Example #26
0
 function getMembers()
 {
     if (!$this->members && $this->getNumUsers()) {
         $sql = 'SELECT staff_id FROM ' . STAFF_TABLE . ' WHERE group_id=' . db_input($this->getId()) . ' ORDER BY lastname, firstname';
         if (($res = db_query($sql)) && db_num_rows($res)) {
             while (list($id) = db_fetch_row($res)) {
                 if ($staff = Staff::lookup($id)) {
                     $this->members[] = $staff;
                 }
             }
         }
     }
     return $this->members;
 }
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id, $this->modelName);
     //$model=$this->loadModel();
     $profile = $model->profile;
     $gprofile = Profile::model()->with('groups')->findbyPk($model->id);
     $profile->group_id = $gprofile->groups;
     $this->performAjaxValidation(array($model, $profile), 'staff-form');
     if (isset($_POST['Staff'])) {
         //$model->attributes=$_POST['Staff'];
         $model->status = $_POST['Staff']['status'];
         //$profile->attributes=$_POST['Profile'];
         $profile->branch_id = $_POST['Profile']['branch_id'];
         if ($model->validate() && $profile->validate()) {
             $old_password = Staff::model()->notsafe()->findByPk($model->id);
             /*if ($old_password->password!=$model->password) {
             			$model->password=PasswordHelper::hashPassword($model->password);
             			$model->activkey=PasswordHelper::hashPassword(microtime().$model->password);
             		}*/
             $model->save();
             $profile->save();
             $criteria = new CDbCriteria();
             $criteria->condition = 'profile_id=:profile_id';
             $criteria->params = array(':profile_id' => $model->id);
             UserGroup::model()->deleteAll($criteria);
             if (!empty($_POST['Profile']['group_id'])) {
                 foreach ($_POST['Profile']['group_id'] as $groupid) {
                     $userGroup = new UserGroup();
                     $userGroup->profile_id = $model->id;
                     $userGroup->group_id = $groupid;
                     $userGroup->save();
                 }
             }
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 $this->renderPartial('_view', array('model' => $model, 'profile' => $profile), false, true);
                 Yii::app()->end();
             }
             $this->redirect(array('view', 'id' => $model->id));
         } else {
             $profile->validate();
         }
     }
     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
         $this->renderPartial('_update', array('model' => $model, 'profile' => $profile), false, true);
         Yii::app()->end();
     }
     $this->render('update', array('model' => $model, 'profile' => $profile));
 }
Example #28
0
 public function configure()
 {
     $params = $this->getOption('params');
     $this->unsetTimeStampable();
     $this->setWidget('staff_id', new sfWidgetFormInputHidden());
     $this->setDefault('staff_id', Staff::loggedInId());
     $this->setDefault('task_id', $params['task_id']);
     if (!$this->getCurrentUser()->isSuperAdmin()) {
         unset($this['is_viewable'], $this['percentage']);
     }
     $this->getOption('params');
     $inOptions = array('widget_name' => 'clock_in', 'params' => $params, 'default_date' => date('Y-m-d'), 'default_time' => date('h:i A'));
     $outOptions = array('widget_name' => 'clock_out', 'params' => $params, 'default_date' => date('Y-m-d'), 'default_time' => date('h:i A'));
     $this->setWidget('clock_in', new sfJQueryDateTimeWidget($inOptions));
     $this->setWidget('clock_out', new sfJQueryDateTimeWidget($outOptions));
     $this->setValidator('clock_in', new sfJQueryDateTimeValidator(array('widget_name' => 'clock_in')));
     $this->setValidator('clock_out', new sfJqueryDateTimeValidator(array('widget_name' => 'clock_out')));
 }
Example #29
0
 public function senaraiSpeedDial2()
 {
     $staff = Staff::where('speedDial', '<>', '0')->where('speedDial', '<>', '')->orderBy('speedDial', 'asc')->get();
     $syarikat = Syarikat::where('speedDial', '<>', '')->where('speedDial', '<>', '0')->orderBy('speedDial', 'asc')->get();
     $speedDialData[] = '';
     foreach ($staff as $staf) {
         $speedDialData[$staf->speedDial] = ['nama' => $staf->nama, 'bahagian' => $staf->bahagian, 'speedDial' => $staf->speedDial, 'noPhone' => $staf->noPhone];
     }
     foreach ($syarikat as $sykt) {
         $speedDialData[$sykt->speedDial] = ['nama' => $sykt->nama, 'bahagian' => $sykt->alamat, 'speedDial' => $sykt->speedDial, 'noPhone' => $sykt->noTel];
     }
     echo '<pre>', var_dump($speedDialData), '</pre>';
     foreach ($speedDialData as $data) {
         echo $data->nama;
     }
     return 'done';
     return View::make('/admin/senarai/speedDial2')->with('title', 'Senarai Speed Dial')->with('data', $speedDialData);
 }
Example #30
0
 public function getUsersData()
 {
     $colid = Session::get('user')->collegeid;
     //$colid = "bt123";
     $users = Staff::whereRaw('collegeid = ?', array($colid))->get();
     $data['data'] = [];
     $i = 0;
     for ($i = 0; $i < sizeof($users); $i++) {
         $data['data'][$i]['name'] = $users[$i]->name;
         $data['data'][$i]['pic'] = "<img class= \"img-circle width-1 height-1\" src=\"." . $users[$i]->profilepic . "\">";
         $data['data'][$i]['email'] = $users[$i]->email;
         $data['data'][$i]['type'] = $users[$i]->type;
         $flag = Auth::user()->flag;
         if ($flag == 3) {
             $data['data'][$i]['action'] = "<button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right;  margin-bottom: -0.6em; margin-top: -0.5em;\" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Copy row\"><i class=\"fa fa-copy\"></i></button>";
         } else {
             $data['data'][$i]['action'] = "<button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right; margin-bottom: -0.6em; margin-top: -0.5em; \" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Delete row\"><i class=\"fa fa-trash-o\"></i></button>\n\n             <button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right;  margin-bottom: -0.6em; margin-top: -0.5em;\" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Copy row\"><i class=\"fa fa-copy\"></i></button>\n\n             <button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right;  margin-bottom: -0.6em; margin-top: -0.5em;\" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Edit row\"><i class=\"fa fa-pencil\"></i></button>";
         }
     }
     return $data;
     //return json_encode($data);
 }