php Utill-Dal-Helper类(方法)实例源码

下面列出了php Utill-Dal-Helper 类(方法)源码代码实例,从而了解它的用法。

作者:kuisat    项目:Slim_UstalarMerkez   
/**    
  * @author Okan CIRAN
  * @ sys_village tablosundan parametre olarak  gelen id kaydını siler. !!
  * @version v 1.0  07.12.2015
  * @param type $params
  * @return array
  * @throws \PDOException
  */
 public function delete($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $userId = $this->getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($userId)) {
             $userIdValue = $userId['resultSet'][0]['user_id'];
             $statement = $pdo->prepare(" \n                UPDATE sys_village\n                SET  deleted= 1 , active = 1 ,\n                     op_user_id = " . $userIdValue . "     \n                WHERE id = :id");
             //Execute our DELETE statement.
             $update = $statement->execute();
             $afterRows = $statement->rowCount();
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "affectedRowsCount" => $afterRows);
         } else {
             $errorInfo = '23502';
             /// 23502  not_null_violation
             $pdo->rollback();
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '');
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:kuisat    项目:Slim_UstalarMerkez   
/**   
  * @author Okan CIRAN
  * @ connection_log tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  10.03.2016
  * @param type $params
  * @return array
  * @throws \PDOException
  */
 public function insert($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectLogFactory');
         $pdo->beginTransaction();
         $userId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($userId)) {
             $userIdValue = $userId['resultSet'][0]['user_id'];
             $addSql = " op_user_id,";
             $addSqlValue = " " . intval($userIdValue) . ", ";
         }
         $sql = "\n                INSERT INTO connection_log(\n                       pk, \n                       type_id,\n                       log_datetime,\n                       url, \n                       path, \n                       ip, \n                       params,\n                       " . $addSql . " \n                       method\n                       \n                       )\n                VALUES (\n                        :pk,\n                        :type_id,\n                        :log_datetime,\n                        :url, \n                        :path, \n                        :ip, \n                        :params,\n                        " . $addSqlValue . " \n                        :method                       \n                                             )   ";
         $statement = $pdo->prepare($sql);
         $statement->bindValue(':pk', $params['pk'], \PDO::PARAM_STR);
         $statement->bindValue(':type_id', $params['type_id'], \PDO::PARAM_INT);
         $statement->bindValue(':log_datetime', $params['log_datetime'], \PDO::PARAM_STR);
         $statement->bindValue(':url', $params['url'], \PDO::PARAM_STR);
         $statement->bindValue(':path', $params['path'], \PDO::PARAM_STR);
         $statement->bindValue(':ip', $params['ip'], \PDO::PARAM_STR);
         $statement->bindValue(':params', $params['params'], \PDO::PARAM_STR);
         $statement->bindValue(':method', $params['method'], \PDO::PARAM_STR);
         echo debugPDO($sql, $params);
         $result = $statement->execute();
         $insertID = $pdo->lastInsertId('connection_log_id_seq');
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         $pdo->commit();
         return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:RabbitMQ_SanalFabrik   
/**
  * user interface fill operation   
  * @author Okan CIRAN
  * @ tree doldurmak için sys_machine_tool_property_definition tablosundan machine_tool_grup_id si
  * verilen kayıtları döndürür !! machine_tool_grup_id değeri boş yada bulunamazsa tüm kayıtları döndürür.
  * @version v 1.0  17.02.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function fillMachineToolGroupPropertyDefinitions($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $machineToolGrupId = 0;
         $whereSql = " WHERE a.deleted = 0 ";
         if (isset($params['machine_tool_grup_id']) && $params['machine_tool_grup_id'] != "") {
             $machineToolGrupId = $params['machine_tool_grup_id'];
             $whereSql .= " AND a.machine_tool_grup_id = " . $machineToolGrupId . "   ";
         } else {
             $whereSql .= "";
         }
         $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
         if (\Utill\Dal\Helper::haveRecord($languageId)) {
             $languageIdValue = $languageId['resultSet'][0]['id'];
         } else {
             $languageIdValue = 647;
         }
         $whereSql .= " AND a.language_id = " . intval($languageIdValue);
         $statement = $pdo->prepare("                \n                  SELECT                    \n                    a.id, \n                    COALESCE(NULLIF(a.property_name, ''), a.property_name_eng) AS name,            \n                    a.property_name_eng as name_eng,\n                    a.unit_grup_id,\n                    a.active ,                    \n                    'open' AS state_type,\n                    'false' AS root_type \n                FROM sys_machine_tool_property_definition a       \n                " . $whereSql . "    \n                ORDER BY name      \n                           \n                                 ");
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/**
  * @author Okan CIRAN
  * @ sys_osb_person tablosundan parametre olarak  gelen id kaydın aktifliğini
  *  0(aktif) ise 1 , 1 (pasif) ise 0  yapar. !!
  * @version v 1.0  29.08.2016
  * @param type $params
  * @return array
  * @throws \PDOException
  */
 public function makeActiveOrPassive($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             if (isset($params['id']) && $params['id'] != "") {
                 $sql = "                 \n                UPDATE sys_osb_person\n                SET active = (  SELECT   \n                                CASE active\n                                    WHEN 0 THEN 1\n                                    ELSE 0\n                                END activex\n                                FROM sys_osb_person\n                                WHERE id = " . intval($params['id']) . "\n                ),\n                op_user_id = " . intval($opUserIdValue) . "\n                WHERE id = " . intval($params['id']);
                 $statement = $pdo->prepare($sql);
                 //  echo debugPDO($sql, $params);
                 $update = $statement->execute();
                 $afterRows = $statement->rowCount();
                 $errorInfo = $statement->errorInfo();
                 if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                     throw new \PDOException($errorInfo[0]);
                 }
             }
             $xc = $this->makeActiveOrPassiveInfoUsers(array('id' => $params['id'], 'op_user_id' => $opUserIdValue));
             if ($xc['errorInfo'][0] != "00000" && $xc['errorInfo'][1] != NULL && $xc['errorInfo'][2] != NULL) {
                 throw new \PDOException($xc['errorInfo']);
             }
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "affectedRowsCount" => $afterRows);
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:kuisat    项目:Slim_UstalarMerkez   
/**
  * 
  * @author Okan CIRAN
  * @ public key e ait danışmanın gerçekleştirdiği operasyonları ve adetlerinin döndürür  !!
  * @version v 1.0  08.03.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function getConsultantOperation($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             //// su anda kullanılmıyor.
             $sql = "     \n               SELECT count(a.id) AS adet , \n                    a.operation_type_id,\n                    op.operation_name as aciklama\n                FROM sys_activation_report a    \n                INNER JOIN sys_operation_types op ON op.parent_id = 2 AND op.id = a.operation_type_id  AND op.deleted =0 AND op.active =0\n                INNER JOIN sys_language l ON l.language_main_code = a.language_code AND l.deleted =0 AND l.active =0 \n                INNER JOIN info_users u ON u.id = a.op_user_id      \n                INNER JOIN sys_acl_roles acl ON acl.id = u.role_id  \n                WHERE \n                    a.op_user_id = " . intval($opUserIdValue) . "\n                GROUP BY a.operation_type_id, op.operation_name\n                ORDER BY op.operation_name\n                    ";
             $statement = $pdo->prepare($sql);
             // echo debugPDO($sql, $params);
             $statement->execute();
             $result = $statement->fetchAll(\PDO::FETCH_CLASS);
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             //return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
             return json_encode($result);
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         //  $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:RabbitMQ_SanalFabrik   
/**
  * @param type $id
  * @param type $params
  * @return array
  * @throws PDOException
  */
 public function deletedAct($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $userId = $this->getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($userId)) {
             $userIdValue = $userId['resultSet'][0]['user_id'];
             $this->setUserDetailsDisables(array('id' => $userIdValue));
             $this->makeUserDeleted(array('id' => $userIdValue));
             $sql = " \n                    INSERT INTO info_users_detail(\n                           profile_public,   \n                           f_check,\n                           s_date,\n                           c_date,\n                           operation_type_id, \n                           name,\n                           surname,                                                                        \n                           auth_email,  \n                           act_parent_id,\n                           auth_allow_id,\n                           cons_allow_id,\n                           language_code,\n                           language_id,\n                           root_id,\n                           op_user_id,\n                           language_id,\n                           password,                           \n                           active,\n                           deleted,\n                            ) \n                           SELECT \n                                profile_public,                           \n                                f_check,   \n                                s_date,                              \n                                timezone('Europe/Istanbul'::text, ('now'::text)::timestamp(0) with time zone) , \n                                3,\n                                name,\n                                surname,                                                                        \n                                auth_email,  \n                                act_parent_id,\n                                auth_allow_id,\n                                cons_allow_id,\n                                language_code,\n                                language_id,\n                                root_id,                               \n                                " . intval($userIdValue) . " AS op_user_id,\n                                language_id,\n                                password,   \n                               1,\n                               1\n                            FROM info_users_detail \n                            WHERE root_id  =" . intval($userIdValue) . " \n                                AND active =0 AND deleted =0 \n \n                    ";
             $insert_act_insert = $statement_act_insert->execute();
             $affectedRows = $statement_act_insert->rowCount();
             $errorInfo = $statement_act_insert->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "affectedRowsCount" => $affectedRows);
         } else {
             $errorInfo = '23502';
             /// 23502  not_null_violation
             $pdo->rollback();
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '');
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:RabbitMQ_SanalFabrik   
/**
  * @author Okan CIRAN     
  * @ info_users_addresses tablosundan parametre olarak  gelen id kaydın active alanını 1 yapar ve 
  * yeni yeni kayıt oluşturarak deleted ve active = 1 olarak  yeni kayıt yapar. ! 
  * @version v 1.0  02.02.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function deletedActTemp($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $userId = InfoUsers::getUserIdTemp(array('pktemp' => $params['pktemp']));
         if (\Utill\Dal\Helper::haveRecord($userId)) {
             $userIdValue = $userId['resultSet'][0]['user_id'];
             $addSql = "";
             $addSqlValue = "";
             if (isset($params['act_parent_id'])) {
                 $act_parent_id = intval($params['act_parent_id']);
                 $addSql .= " act_parent_id, ";
                 if ($act_parent_id == 0) {
                     $act_parent_id = intval($params['id']);
                 }
                 $addSqlValue .= intval($act_parent_id) . ", ";
             }
             if (isset($params['operation_type_id'])) {
                 $addSql .= " operation_type_id, ";
                 $addSqlValue .= intval($params['operation_type_id']) . ", ";
             }
             $this->makePassive(array('id' => $params['id']));
             $statementInsert = $pdo->prepare(" \n                    INSERT INTO info_users_addresses (\n                        user_id,                        \n                        active, \n                        deleted,\n                        op_user_id, \n                        " . $addSql . "\n                        \n                        language_code, \n                        language_id,\n                        address_type_id, \n                        address1, \n                        address2, \n                        postal_code, \n                        country_id, \n                        city_id, \n                        borough_id, \n                        city_name, \n                        description, \n                        description_eng\n                        profile_public,\n                        \n                        f_check, \n                        consultant_id,\n                        consultant_confirm_type_id, \n                        confirm_id,                        \n                        language_parent_id ,\n                        history_parent_id,\n                        consultant_id,\n                        consultant_confirm_type_id,\n                        confirm_id,\n                        act_parent_id\n                        )    \n                        \n                    SELECT\n                        user_id,\n                        1 AS active,  \n                        1 AS deleted, \n                        " . intval($userIdValue) . " AS op_user_id,  \n                        " . $addSqlValue . " \n                            \n                        language_code, \n                        language_id,\n                        address_type_id, \n                        address1, \n                        address2, \n                        postal_code, \n                        country_id, \n                        city_id, \n                        borough_id, \n                        city_name, \n                        description, \n                        description_eng\n                        profile_public,    \n\n                        f_check,                \n                        consultant_id, \n                        consultant_confirm_type_id, \n                        confirm_id,                        \n                        language_parent_id ,\n                        history_parent_id,\n                        consultant_id,\n                        consultant_confirm_type_id,\n                        confirm_id,\n                        act_parent_id\n                    FROM info_users_addresses \n                    WHERE id  =" . intval($params['id']) . "    \n                    )");
             $insertAct = $statementInsert->execute();
             $affectedRows = $statementInsert->rowCount();
             $errorInfo = $statementInsert->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "affectedRowsCount" => $affectedRows);
         } else {
             $errorInfo = '23502';
             /// 23502  not_null_violation
             $errorInfoColumn = 'pk / op_user_id';
             $pdo->rollback();
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:kuisat    项目:Slim_UstalarMerkez   
/**
  * @author Okan CIRAN
  * sys_acl_roles tablosuna parametre olarak gelen id deki kaydın bilgilerini günceller   !!
  * @version v 1.0  07.01.2016
  * @param type $params
  * @return array
  * @throws \PDOException
  */
 public function update($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $kontrol = $this->haveRecords($params);
         if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
             $sql = "\n                UPDATE sys_acl_roles\n                SET   \n                    name = :name,                  \n                    user_id = :user_id                    \n                WHERE id = " . intval($params['id']);
             $statement = $pdo->prepare($sql);
             $statement->bindValue(':name', $params['name'], \PDO::PARAM_STR);
             $statement->bindValue(':user_id', $params['user_id'], \PDO::PARAM_INT);
             $update = $statement->execute();
             $affectedRows = $statement->rowCount();
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "affectedRowsCount" => $affectedRows);
         } else {
             // 23505 	unique_violation
             $errorInfo = '23505';
             // $kontrol ['resultSet'][0]['message'];
             $pdo->rollback();
             $result = $kontrol;
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '');
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:RabbitMQ_SanalFabrik   
/**
  * 
  * @author Okan CIRAN
  * @ Danışmanın onay bekleyen firmalarının bilgilerini döndürür  !!
  * @version v 1.0  05.02.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function getConsWaitingForConfirm($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $sql = "                   \n               SELECT \n                    aciklama , \n                    CASE\n                        WHEN sure_int > 50000 THEN CAST(SUBSTRING(sure FROM 1 FOR POSITION(' ' IN sure )-1 ) AS integer)\n                    ELSE 0 \n                    END AS sure\n                FROM (\n                    SELECT a.id,\n                        EXTRACT(EPOCH FROM age(a.s_date)) AS sure_int,  \n\t\t\ta.firm_name AS aciklama, \n                       CAST(CURRENT_TIMESTAMP - a.s_date AS VARCHAR(20)) AS sure\n                    FROM  info_firm_profile a                 \n                    INNER JOIN info_users u ON u.id = a.consultant_id   \n                    INNER JOIN sys_operation_types op ON op.parent_id = 1 AND a.operation_type_id = op.id AND op.active = 0 AND op.deleted =0\n                    WHERE \n                        a.consultant_id = " . intval($opUserIdValue) . "                     \n                    ) AS asdasd\n                ORDER BY sure DESC\n                LIMIT 6\n  \n                    ";
             $statement = $pdo->prepare($sql);
             // echo debugPDO($sql, $params);
             $statement->execute();
             $result = $statement->fetchAll(\PDO::FETCH_CLASS);
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             //return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
             return json_encode($result);
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
//.........这里部分代码省略.........
                 if ($std['value'] != null) {
                     switch (trim($std['field'])) {
                         case 'name':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\' ';
                             $sorguStr .= " AND name" . $sorguExpression . ' ';
                             break;
                         case 'surname':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\' ';
                             $sorguStr .= " AND surname" . $sorguExpression . ' ';
                             break;
                         case 'positions':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND positions" . $sorguExpression . ' ';
                             break;
                         case 'positions_eng':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND positions_eng" . $sorguExpression . ' ';
                             break;
                         case 'title':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND title" . $sorguExpression . ' ';
                             break;
                         case 'title_eng':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND title_eng" . $sorguExpression . ' ';
                             break;
                         case 'sex_name':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND sex_name" . $sorguExpression . ' ';
                             break;
                         case 'op_user_name':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND op_user_name" . $sorguExpression . ' ';
                             break;
                         case 'state_profile_public':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND state_profile_public" . $sorguExpression . ' ';
                             break;
                         default:
                             break;
                     }
                 }
             }
         } else {
             $sorguStr = null;
             $filterRules = "";
             if (isset($params['name']) && $params['name'] != "") {
                 $sorguStr .= " AND a.name Like '%" . $params['name'] . "%'";
             }
             if (isset($params['surname']) && $params['surname'] != "") {
                 $sorguStr .= " AND surname Like '%" . $params['surname'] . "%'";
             }
             if (isset($params['positions']) && $params['positions'] != "") {
                 $sorguStr .= " AND positions Like '%" . $params['positions'] . "%'";
             }
             if (isset($params['positions_eng']) && $params['positions_eng'] != "") {
                 $sorguStr .= " AND positions_eng Like '%" . $params['positions_eng'] . "%'";
             }
             if (isset($params['title']) && $params['title'] != "") {
                 $sorguStr .= " AND title Like '%" . $params['title'] . "%'";
             }
             if (isset($params['title_eng']) && $params['title_eng'] != "") {
                 $sorguStr .= " AND title_eng Like '%" . $params['title_eng'] . "%'";
             }
             if (isset($params['sex_id']) && $params['sex_id'] != "") {
                 $sorguStr .= " AND sex_id = " . intval($params['sex_id']);
             }
             if (isset($params['profile_public']) && $params['profile_public'] != "") {
                 $sorguStr .= " AND profile_public = " . intval($params['profile_public']);
             }
             if (isset($params['active']) && $params['active'] != "") {
                 $sorguStr .= " AND active = " . intval($params['active']);
             }
             if (isset($params['op_user_name']) && $params['op_user_name'] != "") {
                 $sorguStr .= " AND op_user_name Like '%" . $params['op_user_name'] . "%'";
             }
         }
         $sorguStr = rtrim($sorguStr, "AND ");
         $languageId = NULL;
         $languageIdValue = 647;
         if (isset($params['language_code']) && $params['language_code'] != "") {
             $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
             if (\Utill\Dal\Helper::haveRecord($languageId)) {
                 $languageIdValue = $languageId['resultSet'][0]['id'];
             }
         }
         $sql = " \n                SELECT COUNT(id) AS count \n                FROM (               \n                   SELECT \n                        a.id,\n                        a.firm_id,\t\t\t\t\n\t\t\ta.name, \n\t\t\ta.surname, \t\t\t \n\t\t\tCOALESCE(NULLIF(ax.positions, ''), a.positions_eng) AS positions,\n\t\t\ta.positions_eng,\n\t\t\tCOALESCE(NULLIF(ax.title, ''), a.title_eng) AS title,\n\t\t\ta.title_eng,\n\t\t\ta.sex_id,\t\t\n\t\t\tCOALESCE(NULLIF(sd3x.description, ''), sd3.description_eng) AS sex_name,\n\t\t\ta.s_date,\n                        a.c_date,\n                        a.profile_public,\n                        COALESCE(NULLIF(sd19x.description, ''), sd19.description_eng) AS state_profile_public,\n                        a.operation_type_id,\n                        COALESCE(NULLIF(opx.operation_name, ''), op.operation_name_eng) AS operation_name,\n\t\t\ta.act_parent_id,\n                        COALESCE(NULLIF(lx.id, NULL), 385) AS language_id,\n\t\t        COALESCE(NULLIF(lx.language, ''), 'en') AS language_name,\n                        a.active,\n                        COALESCE(NULLIF(sd16x.description, ''), sd16.description_eng) AS state_active,\n                        a.deleted,\n\t\t\tCOALESCE(NULLIF(sd15x.description, ''), sd15.description_eng) AS state_deleted,\n                        a.op_user_id,\n                        u.username AS op_user_name,\n\t\t\ta.consultant_id, \n\t\t\ta.consultant_confirm_type_id, \n\t\t\ta.confirm_id,\n                        a.cons_allow_id,\n                        COALESCE(NULLIF(sd14x.description, ''), sd14.description_eng) AS cons_allow\n                    FROM info_firm_working_personnel a\n                    INNER JOIN info_users u ON u.id = a.op_user_id\n                    INNER JOIN info_firm_profile fp ON fp.act_parent_id = a.firm_id AND fp.active = 0 AND fp.deleted = 0 AND fp.language_parent_id =0\n                    INNER JOIN sys_language l ON l.id = fp.language_id AND l.deleted =0 AND l.active =0\n                    LEFT JOIN sys_language lx ON lx.id = " . intval($languageIdValue) . " AND lx.deleted =0 AND lx.active =0\n                    INNER JOIN info_firm_keys ifk ON fp.act_parent_id = ifk.firm_id  \n                    LEFT JOIN info_firm_working_personnel ax ON (ax.id = a.id OR ax.language_parent_id = a.id) and ax.language_id =lx.id  AND ax.deleted =0 AND ax.active =0\n\n\t\t    INNER JOIN sys_operation_types op ON op.id = a.operation_type_id AND op.deleted =0 AND op.active =0 AND op.language_parent_id =0\n                    LEFT JOIN sys_operation_types opx ON (opx.id = op.id OR opx.language_parent_id = op.id) and opx.language_id =lx.id  AND opx.deleted =0 AND opx.active =0\n                    \n\t\t    INNER JOIN sys_specific_definitions sd14 ON sd14.main_group = 14 AND a.cons_allow_id = sd14.first_group AND sd14.deleted =0 AND sd14.active =0 AND sd14.language_parent_id =0\n\t\t    INNER JOIN sys_specific_definitions sd15 ON sd15.main_group = 15 AND sd15.first_group= a.deleted AND sd15.deleted =0 AND sd15.active =0 AND sd15.language_parent_id =0\n\t\t    INNER JOIN sys_specific_definitions sd16 ON sd16.main_group = 16 AND sd16.first_group= a.active AND sd16.deleted = 0 AND sd16.active = 0 AND sd16.language_parent_id =0\n\t\t    INNER JOIN sys_specific_definitions sd19 ON sd19.main_group = 19 AND sd19.first_group= a.profile_public AND sd19.deleted = 0 AND sd19.active = 0 AND sd19.language_parent_id =0\n\t\t    INNER JOIN sys_specific_definitions sd3 ON sd3.main_group = 3 AND sd3.first_group= a.sex_id AND sd3.deleted = 0 AND sd3.active = 0 AND sd3.language_parent_id =0\n                  \n                    LEFT JOIN sys_specific_definitions sd14x ON sd14x.language_id = lx.id AND (sd14x.id = sd14.id OR sd14x.language_parent_id = sd14.id) AND sd14x.deleted =0 AND sd14x.active =0\n                    LEFT JOIN sys_specific_definitions sd15x ON sd15x.language_id =lx.id AND (sd15x.id = sd15.id OR sd15x.language_parent_id = sd15.id) AND sd15x.deleted =0 AND sd15x.active =0 \n                    LEFT JOIN sys_specific_definitions sd16x ON sd16x.language_id = lx.id AND (sd16x.id = sd16.id OR sd16x.language_parent_id = sd16.id) AND sd16x.deleted = 0 AND sd16x.active = 0\n                    LEFT JOIN sys_specific_definitions sd19x ON sd19x.language_id = lx.id AND (sd19x.id = sd19.id OR sd19x.language_parent_id = sd19.id) AND sd19x.deleted = 0 AND sd19x.active = 0\n                    LEFT JOIN sys_specific_definitions sd3x ON sd3x.language_id = lx.id AND (sd3x.id = sd3.id OR sd3x.language_parent_id = sd3.id) AND sd3x.deleted = 0 AND sd3x.active = 0\n                    WHERE a.deleted =0 AND a.c_date IS NULL AND a.language_parent_id =0\n                    ) AS xtable WHERE deleted =0  \n                        " . $sorguStr . "  \n                ";
         $statement = $pdo->prepare($sql);
         // echo debugPDO($sql, $params);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
public function fillUnspscCodesTreeRtc($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
         if (\Utill\Dal\Helper::haveRecord($languageId)) {
             $languageIdValue = $languageId['resultSet'][0]['id'];
         } else {
             $languageIdValue = 647;
         }
         $whereSql = " WHERE a.active =0 AND a.deleted = 0 AND a.language_parent_id  = 0  ";
         if (isset($params['parent_id']) && $params['parent_id'] != "") {
             $whereSql .= " AND a.parent_id  = " . intval($params['parent_id']);
         } else {
             $whereSql .= " AND a.parent_id = 0 ";
         }
         $sql = "\n               SELECT \n                    COUNT(a.id ) as COUNT \n                FROM sys_unspsc_codes a                \n                INNER JOIN sys_language l ON l.id = a.language_id AND l.deleted =0 AND l.active =0  \n\t\tLEFT JOIN sys_language lx ON lx.id =" . intval($languageIdValue) . " AND lx.deleted =0 AND lx.active =0                      \t\t\n                LEFT JOIN sys_unspsc_codes su ON (su.id =a.id OR su.language_parent_id = a.id) AND su.deleted =0 AND su.active =0 AND lx.id = su.language_id                \n                " . $whereSql . "              \n                       \n                                 ";
         $statement = $pdo->prepare($sql);
         // echo debugPDO($sql, $params);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:kuisat    项目:Slim_UstalarMerkez   
/**
  * user interface datagrid fill operation get row count for widget
  * @author Okan CIRAN
  * @ Gridi doldurmak için sys_machine_tool_properties tablosundan çekilen kayıtlarının kaç tane olduğunu döndürür   !!
  * @version v 1.0  17.02.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function fillMachineToolFullPropertiesRtc($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
         if (\Utill\Dal\Helper::haveRecord($languageId)) {
             $languageIdValue = $languageId['resultSet'][0]['id'];
         } else {
             $languageIdValue = 647;
         }
         $parentId = 0;
         if (isset($params['id']) && $params['id'] != "") {
             $parentId = $params['id'];
         }
         $whereSql = " WHERE \n                                a.deleted =0 AND \n                                a.active = 0 AND\n                                a.language_parent_id = 0 AND \n                                a.parent_id = " . intval($parentId) . " AND \n                                a.language_id = " . intval($languageIdValue);
         $sql = "\n                 SELECT \n                     COUNT(a.id) AS COUNT               \n                FROM sys_machine_tool_property_definition  a\n                INNER JOIN sys_language l ON l.id = a.language_id AND l.deleted =0 AND l.active =0  \t                                \n                " . $whereSql . "\n                             \n                    ";
         $statement = $pdo->prepare($sql);
         // echo debugPDO($sql, $params);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         //$debugSQLParams = $statement->debugDumpParams();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/**
  * @author Okan CIRAN
  * @ Gridi doldurmak için sys_osb_clusters_alliance tablosundan döndürülen kayıtların adedini döndürür !!
  * @version v 1.0  27.06.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function fillGridAllianceListRtc($args = array())
 {
     $languageId = NULL;
     $languageIdValue = 647;
     if (isset($args['language_code']) && $args['language_code'] != "") {
         $languageId = SysLanguage::getLanguageId(array('language_code' => $args['language_code']));
         if (\Utill\Dal\Helper::haveRecord($languageId)) {
             $languageIdValue = $languageId['resultSet'][0]['id'];
         }
     }
     $sorguStr = null;
     if (isset($params['filterRules']) && $params['filterRules'] != "") {
         $filterRules = trim($params['filterRules']);
         $jsonFilter = json_decode($filterRules, true);
         $sorguExpression = null;
         foreach ($jsonFilter as $std) {
             if ($std['value'] != null) {
                 switch (trim($std['field'])) {
                     case 'osb':
                         $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\' ';
                         $sorguStr .= " AND osb" . $sorguExpression . ' ';
                         break;
                     case 'clusters':
                         $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                         $sorguStr .= " AND clusters" . $sorguExpression . ' ';
                         break;
                     case 'alliance_type_name':
                         $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                         $sorguStr .= " AND alliance_type_name" . $sorguExpression . ' ';
                         break;
                     case 'alliance_name':
                         $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                         $sorguStr .= " AND alliance_name" . $sorguExpression . ' ';
                         break;
                     case 'country_name':
                         $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                         $sorguStr .= " AND country_name" . $sorguExpression . ' ';
                         break;
                     case 'city_name':
                         $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                         $sorguStr .= " AND city_name" . $sorguExpression . ' ';
                         break;
                     case 'borough_name':
                         $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                         $sorguStr .= " AND borough_name" . $sorguExpression . ' ';
                         break;
                     default:
                         break;
                 }
             }
         }
     } else {
         $sorguStr = null;
         $filterRules = "";
         if (isset($params['osb_id']) && $params['osb_id'] != "") {
             $sorguStr .= " AND osb_id = " . $params['osb_id'];
         }
         if (isset($params['clusters_id']) && $params['clusters_id'] != "") {
             $sorguStr .= " AND a.osb_clusters_id " . $params['clusters_id'];
         }
         if (isset($params['alliance_type_id']) && $params['alliance_type_id'] != "") {
             $sorguStr .= " AND alliance_type_id = " . $params['alliance_type_id'];
         }
         if (isset($params['alliance_name']) && $params['alliance_name'] != "") {
             $sorguStr .= " AND alliance_name Like '%" . $params['unitcode_eng'] . "%'";
         }
         if (isset($params['country_id']) && $params['country_id'] != "") {
             $sorguStr .= " AND country_id = " . $params['country_id'];
         }
         if (isset($params['city_id']) && $params['city_id'] != "") {
             $sorguStr .= " AND city_id = " . $params['city_id'];
         }
         if (isset($params['borough_id']) && $params['borough_id'] != "") {
             $sorguStr .= " AND borough_id = " . $params['borough_id'];
         }
     }
     $sorguStr = rtrim($sorguStr, "AND ");
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $sql = "\n                SELECT COUNT(id) AS count FROM (\n                SELECT  id,osb_id,osb,clusters,\n                        alliance_type_id,alliance_type_name,alliance_name,\n                        country_id,country_name,city_id,\n                        city_name,borough_id,borough_name \n                FROM (\n                    SELECT \n                        a.id,\n                        soc.osb_id,\n                        COALESCE(NULLIF(sox.name, ''), so.name_eng) AS osb,\n                        COALESCE(NULLIF(scx.name, ''), sc.name_eng) AS clusters, \n\t\t\ta.alliance_type_id, \n\t\t\tCOALESCE(NULLIF(sd20x.description , ''), sd20.description_eng) AS alliance_type_name,\n\t\t\tCASE \n\t\t\t       a.alliance_type_id  \n\t\t\t\tWHEN 1 THEN (SELECT c.firm_name FROM info_firm_profile c WHERE c.act_parent_id = a.alliance_id AND c.active =0 AND c.deleted =0) \n\t\t\t\tWHEN 2 THEN (SELECT concat(d.name, ' ',  surname) FROM info_users_detail d WHERE d.root_id = a.alliance_id AND d.active =0 AND d.deleted =0) \n\t\t\t\tELSE NULL \n\t\t\tEND AS alliance_name,                        \n                        so.country_id,\n                        co.name AS country_name,\n\t\t\tso.city_id, \n\t\t\tct.name AS city_name,\n\t\t\tso.borough_id, \n\t\t\tbo.name AS borough_name\n                FROM sys_osb_clusters_alliance a                \n                INNER JOIN sys_osb_clusters soc ON soc.id = a.osb_clusters_id AND soc.active =0 AND soc.deleted =0 \n                INNER JOIN sys_osb so ON so.id = soc.osb_id AND so.deleted =0 AND so.active =0 AND so.language_parent_id =0 \n                INNER JOIN sys_language l ON l.id = so.language_id AND l.deleted =0 AND l.active = 0 \n                LEFT JOIN sys_language lx ON lx.id = " . intval($languageIdValue) . " AND lx.deleted =0 AND lx.active =0\n                LEFT JOIN sys_osb sox ON (sox.id = so.id OR sox.language_parent_id = so.id) AND sox.deleted =0 AND sox.active =0 AND lx.id = sox.language_id\n\t\tINNER JOIN sys_clusters sc ON sc.id = soc.clusters_id AND sc.deleted =0 AND sc.active =0 AND l.id = sc.language_id\n                LEFT JOIN sys_clusters scx ON (scx.id = sc.id OR scx.language_parent_id = sc.id) AND scx.deleted =0 AND scx.active =0 AND lx.id = scx.language_id\t\t\n\t\tLEFT JOIN sys_countrys co ON co.id = so.country_id AND co.deleted = 0 AND co.active = 0 AND co.language_id = so.language_id                               \n\t\tLEFT JOIN sys_city ct ON ct.id = so.city_id AND ct.deleted = 0 AND ct.active = 0 AND ct.language_id = so.language_id                               \n\t \tLEFT JOIN sys_borough bo ON bo.boroughs_id = so.borough_id AND bo.city_id = so.city_id AND bo.deleted = 0 AND bo.active = 0 AND bo.language_id = so.language_id                 \n\n\t \tINNER JOIN sys_specific_definitions sd20 ON sd20.main_group = 20 AND sd20.first_group= a.alliance_type_id AND sd20.language_id = so.language_id AND sd20.deleted = 0 \n\t \tLEFT JOIN sys_specific_definitions sd20x ON (sd20x.id = sd20.id OR sd20x.language_parent_id = sd20.id ) AND sd20x.language_id = lx.id AND sd20x.deleted = 0 AND sd20x.active = 0\n                WHERE a.deleted =0 AND a.active =0   \n\t\t) AS tempxx                \n                " . $sorguStr . "                \n                 ";
         $statement = $pdo->prepare($sql);
         //   echo debugPDO($sql, $parameters);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         //$debugSQLParams = $statement->debugDumpParams();
         return array("found" => false, "errorInfo" => $e->getMessage());
//.........这里部分代码省略.........

作者:corner8    项目:Slim_SanalFabrik   
/**
  * @author Okan CIRAN
  * @ sys_acl_action_rrp tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  13.08.2016
  * @param type $params
  * @return array
  * @throws \PDOException
  */
 public function transferRolesActionPrivilege($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $sql = "  \n               INSERT INTO sys_acl_action_rrp(\n                        role_id, \n                        resource_id, \n                        privilege_id,\n                        op_user_id\n                        )\n                VALUES (\n                        " . intval($params['role_id']) . ", \n                        " . intval($params['resource_id']) . ",\n                        " . intval($params['privilege_id']) . ",\n                        " . intval($opUserIdValue) . "\n                    )";
             $statement = $pdo->prepare($sql);
             //  echo debugPDO($sql, $params);
             $result = $statement->execute();
             $insertID = $pdo->lastInsertId('sys_acl_action_rrp_id_seq');
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/** 
  * @author Okan CIRAN
  * @  dropdown ya da tree ye doldurmak için sys_language tablosundan kayıtları döndürür !!
  * @version v 1.0  25.07.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException 
  */
 public function fillCertificationsDdList($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $languageId = NULL;
         $languageIdValue = 647;
         if (isset($params['language_code']) && $params['language_code'] != "") {
             $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
             if (\Utill\Dal\Helper::haveRecord($languageId)) {
                 $languageIdValue = $languageId['resultSet'][0]['id'];
             }
         }
         $statement = $pdo->prepare("\n                SELECT \n                    a.id,\n                    COALESCE(NULLIF(su.certificate, ''), a.certificate_eng) AS certificate_name,  \n                    a.certificate_eng AS certificate_name_eng,\n\t\t    COALESCE(NULLIF(su.certificate_short, ''), a.certificate_short_eng) AS certificate_shorts,  \n                    a.certificate_short_eng,\n\t\t    COALESCE(NULLIF(su.description, ''), a.description_eng) AS descriptions,  \n                    a.description_eng,\n                    a.active,\n                    COALESCE(NULLIF(sd16x.description, ''), sd16.description_eng) AS state_active,\n\t\t    CASE COALESCE(NULLIF(a.logo, ''),'-')\n                        WHEN '-' THEN CONCAT(COALESCE(NULLIF(concat(sps.folder_road,'/'), '/'),''),sps.logos_folder,'/' ,COALESCE(NULLIF(a.logo, ''),'image_not_found.png'))\n                        ELSE CONCAT(COALESCE(NULLIF(concat(sps.folder_road,'/'), '/'),''),sps.logos_folder,'/' ,COALESCE(NULLIF(a.logo, ''),'image_not_found.png')) END AS logo\t\n                FROM sys_certifications a\n                INNER JOIN sys_project_settings sps ON sps.op_project_id = 1 AND sps.active =0 AND sps.deleted =0\n                INNER JOIN sys_language l ON l.id = a.language_id AND l.deleted =0 AND l.active =0  \n\t\tLEFT JOIN sys_language lx ON lx.id = " . intval($languageIdValue) . " AND lx.deleted =0 AND lx.active =0\n                INNER JOIN sys_specific_definitions sd16 ON sd16.main_group = 16 AND sd16.first_group= a.active AND sd16.language_id = l.id  AND sd16.deleted = 0 AND sd16.active = 0\n\t\tLEFT JOIN sys_specific_definitions sd16x ON (sd16x.id = sd16.id OR sd16x.language_parent_id = sd16.id) AND sd16x.deleted =0 AND sd16x.active =0 AND lx.id = sd16x.language_id\n                LEFT JOIN sys_certifications su ON (su.id =a.id OR su.language_parent_id = a.id) AND su.deleted =0 AND su.active =0 AND lx.id = su.language_id \n                WHERE a.language_parent_id = 0 AND a.active =0 AND a.deleted =0 \n                ORDER BY a.priority, certificate_name\n\n                                 ");
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/**
  * @author Okan CIRAN
  * @ sys_osb bilgilerini döndürür !!
  * filterRules aktif 
  * @version v 1.0  19.08.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function fillMachinePropertiesSubGridList($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $languageId = NULL;
         $languageIdValue = 647;
         if (isset($params['language_code']) && $params['language_code'] != "") {
             $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
             if (\Utill\Dal\Helper::haveRecord($languageId)) {
                 $languageIdValue = $languageId['resultSet'][0]['id'];
             }
         }
         $sort = " machine_tool_name, property_name,unitcode ";
         $sorguStr2 = " AND 1 = 2 ";
         if (isset($params['machine_tool_id']) && $params['machine_tool_id'] != "") {
             $sorguStr2 = " AND a.machine_tool_id = " . $params['machine_tool_id'];
         }
         $sql = " \n\t\t SELECT \n                    a.id, \n                    a.machine_tool_id, \n                    COALESCE(NULLIF(mt.machine_tool_name, ''), mt.machine_tool_name_eng) AS machine_tool_name,\n                    mt.machine_tool_name_eng,\n                    a.machine_tool_property_definition_id, \n                    COALESCE(NULLIF(mtpd.property_name, ''), mtpd.property_name_eng) AS property_name,\n                    mtpd.property_name_eng,\n                    a.property_value, \n                    a.property_string_value,\n                    a.unit_id,\n                    COALESCE(NULLIF(su.unitcode, ''), su.unitcode_eng) AS unitcode,\n                    su.unitcode_eng\n                FROM sys_machine_tool_properties a\n                INNER JOIN sys_specific_definitions sd16 ON sd16.main_group = 16 AND sd16.first_group= a.active AND sd16.language_id = " . intval($languageIdValue) . " AND sd16.deleted = 0 AND sd16.active = 0\n                INNER JOIN info_users u ON u.id = a.op_user_id\n                INNER JOIN sys_language l ON l.id = a.language_id AND l.deleted =0 AND l.active = 0  \n                INNER JOIN sys_machine_tools mt ON mt.id = a.machine_tool_id and mt.active =0 and mt.deleted =0 AND mt.language_parent_id =0\n                INNER JOIN sys_units su ON su.id = a.unit_id AND su.active = 0 AND su.deleted =0 AND su.language_id = l.id \n                INNER JOIN sys_machine_tool_property_definition mtpd ON mtpd.id = a.machine_tool_property_definition_id AND mtpd.active =0 AND mtpd.deleted =0 AND mtpd.language_id = l.id \n                WHERE \n                    a.active =0 AND a.deleted =0 AND a.language_parent_id =0\n                " . $sorguStr2 . "\n                ORDER BY    " . $sort . " \n                  ";
         $statement = $pdo->prepare($sql);
         // echo debugPDO($sql, $params);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/**
  *       
  * parametre olarak gelen array deki 'id' li kaydın, info_firm_keys tablosundaki private key ve value değerlerini oluşturur  !!
  * @author Okan CIRAN
  * @version v 1.0  17.03.2016
  * @param array $params 
  * @return array
  * @throws \PDOException
  */
 public function setNetworkKey($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $CountryCode = NULL;
         $CountryCodeValue = 'TR';
         if (isset($params['country_id']) && $params['country_id'] != "") {
             $CountryCode = SysCountrys::getCountryCode(array('country_id' => $params['country_id']));
             if (\Utill\Dal\Helper::haveRecord($CountryCode)) {
                 $CountryCodeValue = $CountryCode['resultSet'][0]['country_code'];
             }
         }
         $statement = $pdo->prepare("\n                UPDATE info_firm_keys\n                SET              \n                  network_key = CONCAT('" . $CountryCodeValue . "',ostim_id_generator())\n                WHERE                   \n                  firm_id = :firm_id");
         $statement->bindValue(':firm_id', $params['firm_id'], \PDO::PARAM_INT);
         $update = $statement->execute();
         $affectedRows = $statement->rowCount();
         $errorInfo = $statement->errorInfo();
         $pdo->commit();
         return array("found" => true, "errorInfo" => $errorInfo, "affectedRowsCount" => $affectedRows);
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/**
  * @author Okan CIRAN
  * @ user in adres , cominication , ad soyad , networkkey bilgilerinin sayısını döndürür !!
  * varsa network_key, name, surname, email , communication_number parametrelerinin like ile arar
  * @version v 1.0  23.06.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function fillPropertieslistRtc($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $languageId = NULL;
         $languageIdValue = 647;
         if (isset($args['language_code']) && $args['language_code'] != "") {
             $languageId = SysLanguage::getLanguageId(array('language_code' => $args['language_code']));
             if (\Utill\Dal\Helper::haveRecord($languageId)) {
                 $languageIdValue = $languageId['resultSet'][0]['id'];
             }
         }
         $sorguStr = null;
         if (isset($params['filterRules']) && $params['filterRules'] != "") {
             $filterRules = trim($params['filterRules']);
             $jsonFilter = json_decode($filterRules, true);
             $sorguExpression = null;
             foreach ($jsonFilter as $std) {
                 if ($std['value'] != null) {
                     switch (trim($std['field'])) {
                         case 'property_name':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\' ';
                             $sorguStr .= " AND COALESCE(NULLIF(smtpdx.property_name, ''), a.property_name_eng)" . $sorguExpression . ' ';
                             break;
                         case 'property_name_eng':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND a.property_name_eng" . $sorguExpression . ' ';
                             break;
                         case 'unitcode':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND COALESCE(NULLIF(sux.unitcode, ''), su.unitcode_eng)" . $sorguExpression . ' ';
                             break;
                         case 'unitcode_eng':
                             $sorguExpression = ' ILIKE \'%' . $std['value'] . '%\'  ';
                             $sorguStr .= " AND su.unitcode_eng" . $sorguExpression . ' ';
                             break;
                         default:
                             break;
                     }
                 }
             }
         } else {
             $sorguStr = null;
             $filterRules = "";
             if (isset($params['property_name']) && $params['property_name'] != "") {
                 $sorguStr .= " AND COALESCE(NULLIF(smtpdx.property_name, ''), a.property_name_eng) Like '%" . $params['property_name'] . "%'";
             }
             if (isset($params['property_name_eng']) && $params['property_name_eng'] != "") {
                 $sorguStr .= " AND a.property_name_eng Like '%" . $params['property_name_eng'] . "%'";
             }
             if (isset($params['unitcode']) && $params['unitcode'] != "") {
                 $sorguStr .= " AND COALESCE(NULLIF(sux.unitcode, ''), su.unitcode_eng) Like '%" . $params['unitcode'] . "%'";
             }
             if (isset($params['unitcode_eng']) && $params['unitcode_eng'] != "") {
                 $sorguStr .= " AND su.unitcode_eng Like '%" . $params['unitcode_eng'] . "%'";
             }
         }
         $sorguStr = rtrim($sorguStr, "AND ");
         $sql = "\n                SELECT count(id) FROM (\n\t\tSELECT \n                    a.id,                                                \n                    COALESCE(NULLIF(smtpdx.property_name, ''), a.property_name_eng) AS property_name,\n                    a.property_name_eng, \n                    COALESCE(NULLIF(sux.unitcode, ''), su.unitcode_eng) AS unitcode,\n                    su.unitcode_eng,                    \n                    a.active,\n                    COALESCE(NULLIF(sd16x.description , ''), sd16.description_eng) AS state_active                                  \n                FROM sys_machine_tool_property_definition  a                                \n                INNER JOIN sys_language l ON l.id = a.language_id AND l.deleted =0 AND l.active = 0 \n                LEFT JOIN sys_language lx ON lx.id = " . intval($languageIdValue) . " AND lx.deleted =0 AND lx.active =0                       \n                INNER JOIN sys_specific_definitions sd16 ON sd16.main_group = 16 AND sd16.first_group= a.active AND sd16.language_id = a.language_id AND sd16.deleted = 0 AND sd16.active = 0\n                LEFT JOIN sys_specific_definitions sd16x ON sd16x.main_group = 16 AND sd16x.first_group= a.active AND sd16x.language_id = lx.id  AND sd16x.deleted = 0 AND sd16x.active = 0\n                LEFT JOIN sys_machine_tool_property_definition smtpdx ON (smtpdx.id = a.id  OR smtpdx.language_parent_id = a.id) AND smtpdx.deleted =0 AND smtpdx.active =0 AND lx.id = smtpdx.language_id \n                INNER JOIN sys_unit_groups_property_definition sugpd ON sugpd.property_id = a.id AND sugpd.active =0 AND sugpd.deleted =0 \n\t\tINNER JOIN sys_units su ON su.id = sugpd.unit_grup_id AND su.deleted =0 AND su.active =0 AND su.language_id = a.language_id \n\t\tINNER JOIN sys_units sux ON sux.id = sugpd.unit_grup_id AND sux.deleted =0 AND sux.active =0 AND sux.language_id = lx.id \n                WHERE a.deleted =0 AND a.language_parent_id = 0\n                " . $sorguStr . "\n                ) as xtemp \n                    ";
         $statement = $pdo->prepare($sql);
         $statement = $pdo->prepare($sql);
         //  echo debugPDO($sql, $params);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/**
  * user interface datagrid fill operation get row count for widget
  * @author Okan CIRAN
  * @ combobox ı doldurmak için sys_city tablosundan çekilen kayıtları döndürür   !!
  * @version v 1.0  17.12.2015
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function fillComboBox($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $languageId = NULL;
         $languageIdValue = 647;
         if (isset($params['language_code']) && $params['language_code'] != "") {
             $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
             if (\Utill\Dal\Helper::haveRecord($languageId)) {
                 $languageIdValue = $languageId['resultSet'][0]['id'];
             }
         }
         $sql = "\n              SELECT \n\t\ta.city_id AS id,\n                COALESCE(NULLIF( COALESCE(NULLIF(sd.name, ''), a.name_eng),''), a.name) AS name,\n                a.name_eng,\n                CASE (SELECT COUNT(z.id) FROM sys_borough z WHERE z.country_id = a.country_id) \n\t\t\tWHEN 0 THEN false\n\t\t\tELSE true END AS boroughlist,\n                a.active\n                FROM sys_city a\n                INNER JOIN sys_language l ON l.id = a.language_id AND l.deleted =0 AND l.active =0\n\t\tLEFT JOIN sys_language lx ON lx.id = " . intval($languageIdValue) . "  AND lx.deleted =0 AND lx.active =0\n\t\tLEFT JOIN sys_city sd ON (sd.id =a.id OR sd.language_parent_id = a.id) AND sd.deleted =0 AND sd.active =0 AND lx.id = sd.language_id                               \n                WHERE a.active = 0 AND a.deleted = 0 \n                AND a.country_id = " . intval($params['country_id']) . "                   \n                ORDER BY a.priority ASC, name               \n                                 ";
         $statement = $pdo->prepare($sql);
         // echo debugPDO($sql, $params);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }

作者:corner8    项目:Slim_SanalFabrik   
/**      
  * @author Okan CIRAN
  * @ Quest için npk lı firmanın danısman tarafından onaylanmış kayıtların sayısını döndürür !!
  * @version v 1.0  30.05.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function fillFirmSectorNpkQuestRtc($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $firmIdValue = NULL;
         $getFirm = InfoFirmProfile::getFirmIdsForNetworkKey(array('network_key' => $params['network_key']));
         if (\Utill\Dal\Helper::haveRecord($getFirm)) {
             $firmIdValue = $getFirm['resultSet'][0]['firm_id'];
             $sql = " \n                    SELECT \n                        COUNT(a.id) AS count \n                    FROM info_firm_sectoral a\n                    INNER JOIN info_users u ON u.id = a.op_user_id\n                    INNER JOIN info_firm_profile fp ON fp.act_parent_id = a.firm_id AND fp.cons_allow_id=2 AND fp.language_parent_id =0\n                    INNER JOIN sys_language l ON l.id = fp.language_id AND l.deleted =0 AND l.active =0                    \n                    INNER JOIN info_firm_keys ifk ON fp.act_parent_id = ifk.firm_id  \n\t\t    INNER JOIN sys_sectors ss ON ss.id = a.sector_id AND ss.deleted =0 AND ss.active =0 AND ss.language_parent_id =0                    \n\t\t    WHERE \n                        a.firm_id =  " . intval($firmIdValue) . " AND\n                        a.cons_allow_id =2 AND\n\t\t\ta.profile_public=0                 \n                            ";
             $statement = $pdo->prepare($sql);
             //echo debugPDO($sql, $params);
             $statement->execute();
             $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'npk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }


问题


面经


文章

微信
公众号

扫码关注公众号