private function isValid($userid)
 {
     $userTable = new Table\UserTable();
     if ($userTable->validate($userid)) {
         return SUCCESS;
     } else {
         return FAIL;
     }
 }
Ejemplo n.º 2
0
 /**
  * get user select form (for error)
  * @param array $_data
  * @return array
  */
 public function getUserList($_data)
 {
     $ret = array();
     $db = new UserTable();
     $user_no = gv('user_no', $_data);
     if ($user_no) {
         $where = array('m_user.user_no IN (' . implode(', ', $user_no) . ")");
         $ret = $db->getTiltleUserPairs($where);
     }
     return $ret;
 }
Ejemplo n.º 3
0
 public function getApproverList($ids)
 {
     //3,5
     $idsAr = explode(',', $ids);
     $userTable = new UserTable();
     $rowSet = $userTable->getTiltleUserPairs(array(), $idsAr);
     //var_dump($rowSet);
     // 2,5,12
     //array(3) { [12]=> string(33) "Marvin Manguiat (Supervisor - PH)" [6]=> string(29) "Yokota Tetsuya (Manager - PH)" [5]=> string(28) "Yoshikawa Ken (Manager - PH)" }
     $selectData = array();
     if (count($idsAr) > 0) {
         foreach ($idsAr as $id) {
             $selectData[$id] = $rowSet[$id];
         }
     }
     return $selectData;
 }
 public function index()
 {
     $this->autoRender = false;
     $data = $this->request->data;
     if (empty($data)) {
         $this->response->body(DTO\ClsErrorDto::prepareError(106));
         \Cake\Log\Log::debug("Image data empty");
         return;
     }
     if (!array_key_exists('userId', $data) or !array_key_exists('emailId', $data) or !array_key_exists('userName', $data)) {
         $this->response->body(DTO\ClsErrorDto::prepareError(107));
         \Cake\Log\Log::debug("Image data empty");
         return;
     }
     $userTable = new Table\UserTable();
     if (!$userTable->userCkeck($data['userId'], $data['emailId'], $data['userName'])) {
         $this->response->body(DTO\ClsErrorDto::prepareError(112));
         return;
     }
     if (array_key_exists('destId', $data)) {
         $imagesController = new ImagesController();
         $result = $imagesController->uploadDestinationImage($data);
         if ($result) {
             \Cake\Log\Log::debug("Destination image uploaded successfully");
         } else {
             \Cake\Log\Log::error("Invalid image extension");
         }
     } else {
         $imagesController = new ImagesController();
         $result = $imagesController->uploadProfileImage($data);
         if ($result) {
             \Cake\Log\Log::debug("profile image uploaded successfully");
         } else {
             \Cake\Log\Log::error("Invalid image extension");
         }
     }
 }
 public function userValidation($userid, $usermail, $userName)
 {
     $userTable = new Table\UserTable();
     if ($userTable->userCkeck($userid, $usermail, $userName)) {
         return SUCCESS;
     }
     return FAIL;
 }
 private function updateProfile(DTO\ClsUserDto $userDto)
 {
     $userTable = new Table\UserTable();
     $result = $userTable->updateProfileImage($userDto->userId, $userDto->photoUrl);
     if ($result) {
         return SUCCESS;
     } else {
         return FAIL;
     }
 }
Ejemplo n.º 7
0
 /**
  * 
  * @param unknown $_user_no
  * @param unknown $ref_no
  */
 public function insertDraft($_user_no, $_ref_no)
 {
     $_user_no = (int) $_user_no;
     if (!$_user_no) {
         return false;
     }
     //get user branch no
     $userObj = new UserTable();
     $branchData = $userObj->select(array('user_no' => $_user_no))->current();
     $branch_no = (int) $branchData['branch_no'];
     if (!$branch_no) {
         throw new \Exception("Invalid Brach no");
     }
     $data = array('decision_title' => 'draf', 'status' => 'draft', 'branch_no' => (int) $branchData['branch_no'], 'ref_no' => $_ref_no, 'update_user' => (int) $_user_no, 'create_user' => (int) $_user_no, 'create_time' => new Expression('UTC_TIMESTAMP'), 'update_time' => new Expression('UTC_TIMESTAMP'));
     $this->insert($data);
     return $this->getLastInsertValue();
 }
Ejemplo n.º 8
0
 public function getApproverProxiesAction()
 {
     $this->init();
     // check auth
     $success = 1 < $this->ctrlLv ? true : false;
     if (!$success) {
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'forbidden'));
     }
     $viewJson = new JsonModel();
     $user_no = (int) $this->params()->fromRoute('id');
     // $logged_in_user = (int)$this->auth()->get('user_no'); //avoid picking his own rec
     //  $user_no = (int)$this->params()->fromPost('user_no');
     if (!$user_no) {
         $viewJson->setVariables(array('message' => 'failed'));
         return $viewJson;
     }
     $userTable = new UserTable();
     $proxies = $userTable->getApproverProxies($user_no);
     if (!$proxies) {
         $proxies = array('message' => 'failed');
     }
     $filtered_proxies = array();
     foreach ($proxies as $k => $v) {
         if ($k != $this->auth()->get('user_no')) {
             $filtered_proxies[$k] = $v;
         }
     }
     $viewJson->setVariables($filtered_proxies);
     return $viewJson;
 }
Ejemplo n.º 9
0
 public function getUserList()
 {
     $where = array('user_no > 1');
     $db = new UserTable();
     return $db->getTiltleUserPairs(null, null, 0, $where);
 }