当前位置: 首页>>代码示例>>PHP>>正文


PHP UsersPeer::retrieveByPK方法代码示例

本文整理汇总了PHP中UsersPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP UsersPeer::retrieveByPK方法的具体用法?PHP UsersPeer::retrieveByPK怎么用?PHP UsersPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UsersPeer的用法示例。


在下文中一共展示了UsersPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeIndex

 /**
  * Executes index action
  *
  */
 public function executeIndex()
 {
     $u_id = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', '-1', 'subscriber');
     if ($u_id <= 0) {
         $this->subscribe = null;
         if ($this->getRequest()->getMethod() == sfRequest::POST) {
             try {
                 $newUser = $this->getRequestParameter('email');
                 $this->subscribe = 'Thanks, we will contact you shortly at the email address you have provided';
                 /*$connection = new Swift_Connection_SMTP('smtp.gmail.com', 465, Swift_Connection_SMTP::ENC_SSL);
                           $connection->setUsername('cyclebrain@gmail.com');
                           $connection->setPassword('bRb061626');
                 
                           $mailer = new Swift($connection);
                           $message = new Swift_Message('USER REQUEST-'.$email);
                 
                           // Send
                           $mailer->send($message, 'cyclebrain@gmail.com', 'cyclebrain@gmail.com');
                           $mailer->disconnect();
                         */
                 $email = new CycleBrainEmail();
                 $email->sendEmail('cyclebrain@gmail.com', 'admin@cyclebrain.com', 'BETA USER', $newUser);
             } catch (Exception $e) {
                 echo 'MainActions:Index Caught exception: ', $e->getMessage(), "\n";
             }
         }
     } else {
         $this->user = UsersPeer::retrieveByPK($u_id);
     }
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:34,代码来源:actions.class.php

示例2: userNameFormat

 public function userNameFormat($username, $fullname, $usrUid = '')
 {
     $aux = '';
     if ($usrUid != '') {
         $oUser = UsersPeer::retrieveByPK($usrUid);
         $aux = str_replace('@userName', trim($username), $this->UserConfig['format']);
         $aux = str_replace('@firstName', $oUser->getUsrFirstname(), $aux);
         $aux = str_replace('@lastName', $oUser->getUsrLastname(), $aux);
     }
     return $aux;
 }
开发者ID:norahmollo,项目名称:processmaker,代码行数:11,代码来源:class.configuration.php

示例3: uxUserUpdate

 public function uxUserUpdate($httpData)
 {
     require_once 'classes/model/Users.php';
     $data = G::json_decode($httpData->users);
     $list = array();
     if (!is_array($data)) {
         $list[0] = (array) $data;
     } else {
         $list = $data;
     }
     $rows = array();
     foreach ($list as $value) {
         $value = (array) $value;
         $user = UsersPeer::retrieveByPK($value['USR_UID']);
         $user->setUsrUx($value['USR_UX']);
         $user->save();
         $row = $user->toArray(BasePeer::TYPE_FIELDNAME);
         $uxList = self::getUxTypesList();
         $row['USR_UX'] = $uxList[$user->getUsrUx()];
         $rows[] = $row;
     }
     if (count($rows) == 1) {
         $retRow = $rows[0];
     } else {
         $retRow = $rows;
     }
     return array('success' => true, 'message' => 'done', 'users' => $retRow);
 }
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:28,代码来源:adminProxy.php

示例4: uxUserUpdate

 public function uxUserUpdate($httpData)
 {
     require_once 'classes/model/Users.php';
     $data = G::json_decode($httpData->users);
     $list = array();
     if (!is_array($data)) {
         $list[0] = (array) $data;
     } else {
         $list = $data;
     }
     $oRoles = new Roles();
     $rows = array();
     foreach ($list as $value) {
         $value = (array) $value;
         $user = UsersPeer::retrieveByPK($value['USR_UID']);
         $user->setUsrUx($value['USR_UX']);
         $user->save();
         $row = $user->toArray(BasePeer::TYPE_FIELDNAME);
         try {
             $uRole = $oRoles->loadByCode($row['USR_ROLE']);
         } catch (exception $oError) {
             $uRole['ROL_NAME'] = G::loadTranslation('ID_DELETED');
         }
         $row['USR_ROLE_ID'] = $row['USR_ROLE'];
         $row['USR_ROLE'] = isset($uRole['ROL_NAME']) ? $uRole['ROL_NAME'] != '' ? $uRole['ROL_NAME'] : $uRole['USR_ROLE'] : $uRole['USR_ROLE'];
         $uxList = self::getUxTypesList();
         $row['USR_UX'] = $uxList[$user->getUsrUx()];
         $rows[] = $row;
     }
     if (count($rows) == 1) {
         $retRow = $rows[0];
     } else {
         $retRow = $rows;
     }
     return array('success' => true, 'message' => 'done', 'users' => $retRow);
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:36,代码来源:adminProxy.php

示例5: PMFGetUserEmailAddress

/**
 * @method
 *
 * Returns a list or user.
 *
 * @name PMFGetUserEmailAddress
 * @label PMF Get User Email Address
 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFGetUserEmailAddress.28.29
 *
 * @param string(32) or Array | $id | Case ID | Id of the case.
 * @param string(32) | $APP_UID = null | Application ID | Id of the Application.
 * @param string(32) | $prefix = "usr" | prefix | Id of the task.
 * @return array | $aRecipient | Array of the Recipient | Return an Array of the Recipient.
 *
 */
function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix = 'usr')
{
    require_once 'classes/model/UsersPeer.php';
    require_once 'classes/model/AppDelegation.php';
    G::LoadClass('case');
    if (is_string($id) && trim($id) == "") {
        return false;
    }
    if (is_array($id) && count($id) == 0) {
        return false;
    }
    //recipient to store the email addresses
    $aRecipient = array();
    $aItems = array();
    /*
     * First at all the $id user input can be by example erik@colosa.com
     * 2.this $id param can be a array by example Array('000000000001','000000000002') in this case $prefix is necessary
     * 3.this same param can be a array by example Array('usr|000000000001', 'usr|-1', 'grp|2245141479413131441')
     */
    /*
     * The second thing is that the return type will be configurated depend of the input type (using $retType)
     */
    if (is_array($id)) {
        $aItems = $id;
        $retType = 'array';
    } else {
        $retType = 'string';
        if (strpos($id, ",") !== false) {
            $aItems = explode(',', $id);
        } else {
            array_push($aItems, $id);
        }
    }
    foreach ($aItems as $sItem) {
        //cleaning for blank spaces into each array item
        $sItem = trim($sItem);
        if (strpos($sItem, "|") !== false) {
            // explode the parameter because  always will be compose with pipe separator to indicate
            // the type (user or group) and the target mai
            list($sType, $sID) = explode('|', $sItem);
            $sType = trim($sType);
            $sID = trim($sID);
        } else {
            $sType = $prefix;
            $sID = $sItem;
        }
        switch ($sType) {
            case 'ext':
                if (G::emailAddress($sID)) {
                    array_push($aRecipient, $sID);
                }
                break;
            case 'usr':
                if ($sID == '-1') {
                    // -1: Curent user, load from user record
                    if (isset($APP_UID)) {
                        $oAppDelegation = new AppDelegation();
                        $aAppDel = $oAppDelegation->getLastDeleration($APP_UID);
                        if (isset($aAppDel)) {
                            $oUserRow = UsersPeer::retrieveByPK($aAppDel['USR_UID']);
                            if (isset($oUserRow)) {
                                $sID = $oUserRow->getUsrEmail();
                            } else {
                                throw new Exception('User with ID ' . $oAppDelegation->getUsrUid() . 'doesn\'t exist');
                            }
                            if (G::emailAddress($sID)) {
                                array_push($aRecipient, $sID);
                            }
                        }
                    }
                } else {
                    $oUserRow = UsersPeer::retrieveByPK($sID);
                    if ($oUserRow != null) {
                        $sID = $oUserRow->getUsrEmail();
                        if (G::emailAddress($sID)) {
                            array_push($aRecipient, $sID);
                        }
                    }
                }
                break;
            case 'grp':
                G::LoadClass('groups');
                $oGroups = new Groups();
                $oCriteria = $oGroups->getUsersGroupCriteria($sID);
                $oDataset = GroupwfPeer::doSelectRS($oCriteria);
//.........这里部分代码省略.........
开发者ID:ralpheav,项目名称:processmaker,代码行数:101,代码来源:class.pmFunctions.php

示例6:

                 }
             }
         } else {
             $lang = $frm['USER_LANG'];
         }
     }
 } else {
     if (defined("SYS_LANG") && SYS_LANG != "") {
         $lang = SYS_LANG;
     } else {
         $lang = 'en';
     }
 }
 /*----------------------------------********---------------------------------*/
 //Set User Time Zone
 $user = UsersPeer::retrieveByPK($_SESSION['USER_LOGGED']);
 if (!is_null($user)) {
     $userTimeZone = $user->getUsrTimeZone();
     if (trim($userTimeZone) == '') {
         $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
         $userTimeZone = $arraySystemConfiguration['time_zone'];
     }
     $_SESSION['USR_TIME_ZONE'] = $userTimeZone;
 }
 /*----------------------------------********---------------------------------*/
 //Set data
 $aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
 $RBAC->loadUserRolePermission($RBAC->sSystem, $_SESSION['USER_LOGGED']);
 //$rol = $RBAC->rolesObj->load($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_UID']);
 $_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
 //$_SESSION['USR_ROLENAME'] = $rol['ROL_NAME'];
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:authentication.php

示例7: checkReplacedByUser

    function checkReplacedByUser ($user)

    {

        if (is_string( $user )) {

            $userInstance = UsersPeer::retrieveByPK( $user );

        } else {

            $userInstance = $user;

        }

        if (! is_object( $userInstance )) {

            throw new Exception( "The user with the UID '$user' doesn't exist." );

        }

        if ($userInstance->getUsrStatus() == 'ACTIVE') {

            return $userInstance->getUsrUid();

        } else {

            $userReplace = trim( $userInstance->getUsrReplacedBy() );

            if ($userReplace != '') {

                return $this->checkReplacedByUser( UsersPeer::retrieveByPK( $userReplace ) );

            } else {

                return '';

            }

        }

    }
开发者ID:rrsc,项目名称:processmaker,代码行数:41,代码来源:class.derivation.php

示例8: _getUXLocation

 /**
  * New feature - User Experience Redirector
  *
  * @author Erik Amaru Ortiz <erik@colosa.com>
  */
 public function _getUXLocation()
 {
     require_once 'classes/model/Users.php';
     $u = UsersPeer::retrieveByPK($this->usrID);
     $url = '';
     $uxType = $u->getUsrUx();
     $_SESSION['user_experience'] = 'NORMAL';
     // find a group setting
     if ($uxType == '' || $uxType == 'NORMAL') {
         require_once 'classes/model/GroupUser.php';
         $gu = new GroupUser();
         $ugList = $gu->getAllUserGroups($this->usrID);
         foreach ($ugList as $row) {
             if ($row['GRP_UX'] != 'NORMAL' && $row['GRP_UX'] != '') {
                 $uxType = $row['GRP_UX'];
                 break;
             }
         }
     }
     switch ($uxType) {
         case 'SIMPLIFIED':
         case 'SWITCHABLE':
         case 'SINGLE':
             $_SESSION['user_experience'] = $uxType;
             $_SESSION['user_last_skin'] = SYS_SKIN;
             $url = '/sys' . SYS_SYS . '/' . $this->lang . '/uxs/' . 'home';
             break;
     }
     return $url;
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:35,代码来源:UsersProperties.php

示例9: getAllInformation

    public function getAllInformation ($userUid)
    {
        if (! isset( $userUid ) || $userUid == "") {
            throw (new Exception( "$userUid is empty." ));
        }

        try {
            require_once ("classes/model/IsoCountry.php");
            require_once ("classes/model/IsoLocation.php");
            require_once ("classes/model/IsoSubdivision.php");
            require_once ("classes/model/Language.php");

            G::LoadClass( "calendar" );

            $aFields = $this->load( $userUid );

            $c = new Criteria( "workflow" );
            $c->add( IsoCountryPeer::IC_UID, $aFields["USR_COUNTRY"] );
            $rs = IsoCountryPeer::doSelectRS( $c );
            $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
            $rs->next();
            $rowC = $rs->getRow();

            $c->clearSelectColumns();
            $c->add( IsoSubdivisionPeer::IC_UID, $aFields["USR_COUNTRY"] );
            $c->add( IsoSubdivisionPeer::IS_UID, $aFields["USR_CITY"] );
            $rs = IsoSubdivisionPeer::doSelectRS( $c );
            $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
            $rs->next();
            $rowS = $rs->getRow();

            $c->clearSelectColumns();
            $c->add( IsoLocationPeer::IC_UID, $aFields["USR_COUNTRY"] );
            $c->add( IsoLocationPeer::IL_UID, $aFields["USR_LOCATION"] );
            $rs = IsoLocationPeer::doSelectRS( $c );
            $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
            $rs->next();
            $rowL = $rs->getRow();

            //Calendar
            $calendar = new Calendar();
            $calendarInfo = $calendar->getCalendarFor( $userUid, $userUid, $userUid );
            $aFields["USR_CALENDAR"] = ($calendarInfo["CALENDAR_APPLIED"] != "DEFAULT") ? $calendarInfo["CALENDAR_UID"] : "";

            //Photo
            $pathPhoto = PATH_IMAGES_ENVIRONMENT_USERS . $userUid . ".gif";

            if (! file_exists( $pathPhoto )) {
                $pathPhoto = PATH_HOME . "public_html" . PATH_SEP . "images" . PATH_SEP . "user.gif";
            }

            //Data
            $arrayData = array ();
            $arrayData["username"] = $aFields["USR_USERNAME"];
            $arrayData["firstname"] = $aFields["USR_FIRSTNAME"];
            $arrayData["lastname"] = $aFields["USR_LASTNAME"];
            $arrayData["mail"] = $aFields["USR_EMAIL"];
            $arrayData["address"] = $aFields["USR_ADDRESS"];
            $arrayData["zipcode"] = $aFields["USR_ZIP_CODE"];
            $arrayData["country"] = $rowC["IC_NAME"];
            $arrayData["state"] = $rowS["IS_NAME"];
            $arrayData["location"] = $rowL["IL_NAME"];
            $arrayData["phone"] = $aFields["USR_PHONE"];
            $arrayData["fax"] = $aFields["USR_FAX"];
            $arrayData["cellular"] = $aFields["USR_CELLULAR"];
            $arrayData["birthday"] = $aFields["USR_BIRTHDAY"];
            $arrayData["position"] = $aFields["USR_POSITION"];
            $arrayData["replacedby"] = $aFields["USR_REPLACED_BY"];
            if(strlen($arrayData["replacedby"] != 0)){
                $oUser = UsersPeer::retrieveByPK( $arrayData["replacedby"] );
                $arrayData["replacedbyfullname"] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
            }
            $arrayData["duedate"] = $aFields["USR_DUE_DATE"];
            $arrayData["calendar"] = $aFields["USR_CALENDAR"];
            if(strlen($aFields["USR_CALENDAR"] != 0)){
                $arrayData["calendarname"] = $calendar->calendarName( $aFields["USR_CALENDAR"] );
            }
            $arrayData["status"] = $aFields["USR_STATUS"];
            $arrayData["department"] = $aFields["DEP_UID"];
            if (strlen($arrayData["department"]) != 0) {
                $oDepart = DepartmentPeer::retrieveByPk( $arrayData["department"] );
                $arrayData["departmentname"] = $oDepart->getDepTitle();
            }
            $arrayData["reportsto"] = $aFields["USR_REPORTS_TO"];
            $arrayData["userexperience"] = $aFields["USR_UX"];
            $arrayData["photo"] = $pathPhoto;

            return $arrayData;
        } catch (Exception $e) {
            throw $e;
        }
    }
开发者ID:nhenderson,项目名称:processmaker,代码行数:92,代码来源:Users.php

示例10: addProcessSupervisor

 /**
  * Assign a supervisor of a process
  *
  * @param string $sProcessUID
  * @param string $sUsrUID
  * @param string $sTypeUID
  * @access public
  */
 public function addProcessSupervisor($sProcessUID, $sUsrUID, $sTypeUID)
 {
     $sPuUIDT = array();
     $oProcessUser = new \ProcessUser ( );
     $oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sUsrUID );
     $oTypeAssigneeU = \UsersPeer::retrieveByPK( $sUsrUID );
     if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
         throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_CORRESPOND_TYPE", array($sUsrUID, $sTypeUID)));
     }
     if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
         if ( "SUPERVISOR"!= $sTypeUID ) {
             throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_CORRESPOND_TYPE", array($sUsrUID, $sTypeUID)));
         }
     }
     if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
         if ( "GROUP_SUPERVISOR" != $sTypeUID ) {
             throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_CORRESPOND_TYPE", array($sUsrUID, $sTypeUID)));
         }
     }
     // validate Groups
     $oCriteria = new \Criteria('workflow');
     $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID);
     $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID);
     $oCriteria->addAsColumn('GRP_TITLE', \ContentPeer::CON_VALUE);
     $aConditions [] = array(\ProcessUserPeer::USR_UID, \ContentPeer::CON_ID);
     $aConditions [] = array(\ContentPeer::CON_CATEGORY, \DBAdapter::getStringDelimiter().'GRP_TITLE'.\DBAdapter::getStringDelimiter());
     $aConditions [] = array(\ContentPeer::CON_LANG, \DBAdapter::getStringDelimiter().SYS_LANG.\DBAdapter::getStringDelimiter());
     $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
     $oCriteria->add(\ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
     $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
     $oCriteria->add(\ProcessUserPeer::USR_UID, $sUsrUID);
     $oCriteria->addAscendingOrderByColumn(\ContentPeer::CON_VALUE);
     $oDataset = \ProcessUserPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $sPuUIDT = $aRow['PU_UID'];
         $oDataset->next();
     }
     // validate Users
     $oCriteria = new \Criteria('workflow');
     $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID);
     $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID);
     $oCriteria->addJoin(\ProcessUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
     $oCriteria->add(\ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
     $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
     $oCriteria->add(\ProcessUserPeer::USR_UID, $sUsrUID);
     $oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME);
     $oDataset = \ProcessUserPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $sPuUIDT = $aRow['PU_UID'];
         $oDataset->next();
     }
     if (sizeof($sPuUIDT) == 0) {
         $sPuUID = \G::generateUniqueID();
         $oProcessUser->create(array('PU_UID' => $sPuUID,
                                     'PRO_UID' => $sProcessUID,
                                     'USR_UID' => $sUsrUID,
                                     'PU_TYPE' => $sTypeUID));
         $oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID);
         return $oCriteria;
     } else {
         throw new \Exception(\G::LoadTranslation("ID_RELATION_EXIST"));
     }
 }
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:75,代码来源:ProcessSupervisor.php

示例11: __isAllowed

 /**
  * Access verification method.
  *
  * API access will be denied when this method returns false
  *
  * @return boolean true when api access is allowed; false otherwise
  */
 public function __isAllowed()
 {
     $request = \OAuth2\Request::createFromGlobals();
     $allowed = $this->server->verifyResourceRequest($request);
     $token = $this->server->getAccessTokenData($request);
     self::$userId = $token['user_id'];
     // Session handling to prevent session lose in other places like, home, admin, etc
     // when user is using the new designer that have not session because it is using only the API
     if ($allowed && $token['client_id'] == self::getPmClientId()) {
         $pmAccessToken = new \PmoauthUserAccessTokens();
         $session = $pmAccessToken->getSessionData($token['ACCESS_TOKEN']);
         if ($session !== false && array_key_exists($session->getSessionName(), $_COOKIE)) {
             // increase the timeout for local php session cookie
             $config = \Bootstrap::getSystemConfiguration();
             if (isset($config['session.gc_maxlifetime'])) {
                 $lifetime = $config['session.gc_maxlifetime'];
             } else {
                 $lifetime = ini_get('session.gc_maxlifetime');
             }
             if (empty($lifetime)) {
                 $lifetime = 1440;
             }
             setcookie($session->getSessionName(), $_COOKIE[$session->getSessionName()], time() + $lifetime, "/", null, false, true);
         }
         //Set User Time Zone
         $user = \UsersPeer::retrieveByPK(self::$userId);
         if (!is_null($user)) {
             $userTimeZone = $user->getUsrTimeZone();
             if (trim($userTimeZone) == '') {
                 $arraySystemConfiguration = \System::getSystemConfiguration('', '', SYS_SYS);
                 $userTimeZone = $arraySystemConfiguration['time_zone'];
             }
             $_SESSION['USR_TIME_ZONE'] = $userTimeZone;
         }
     }
     return $allowed;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:44,代码来源:Server.php

示例12: loadDetailed

    public function loadDetailed ($UsrUid)
    {
        try {
            $result = array ();
            $oUser = UsersPeer::retrieveByPK( $UsrUid );

            if (! is_null( $oUser )) {
                $aFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME );
                $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
                $this->setNew( false );

                $aIsoCountry = IsoCountry::findById( $aFields['USR_COUNTRY'] );
                $aIsoSubdivision = IsoSubdivision::findById( $aFields['USR_COUNTRY'], $aFields['USR_CITY'] );
                $aIsoLocation = IsoLocation::findById( $aFields['USR_COUNTRY'], $aFields['USR_CITY'], $aFields['USR_LOCATION'] );

                $aFields["USR_COUNTRY_NAME"]  = (!empty($aIsoCountry["IC_NAME"]))? $aIsoCountry["IC_NAME"] : "";
                $aFields["USR_CITY_NAME"]     = (!empty($aIsoSubdivision["IS_NAME"]))? $aIsoSubdivision["IS_NAME"] : "";
                $aFields["USR_LOCATION_NAME"] = (!empty($aIsoLocation["IL_NAME"]))? $aIsoLocation["IL_NAME"] : "";

                require_once PATH_RBAC . "model/Roles.php";
                $roles = new Roles();
                $role = $roles->loadByCode($aFields['USR_ROLE']);
                $aFields['USR_ROLE_NAME'] = $role['ROL_NAME'];

                $result = $aFields;

                return $result;
            } else {
                //return $result;
                throw (new Exception(G::LoadTranslation("ID_USER_UID_DOESNT_EXIST", SYS_LANG, array("USR_UID" => $UsrUid))));
            }
        } catch (Exception $oError) {
            throw ($oError);
        }
    }
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:35,代码来源:Users.php

示例13: delete

 /**
  * Implementation for 'DELETE' method for Rest API
  *
  * @param  mixed $usrUid Primary key
  *
  * @return array $result Returns array within multiple records or a single record depending if
  *                       a single selection was requested passing id(s) as param
  */
 protected function delete($usrUid)
 {
     $conn = Propel::getConnection(UsersPeer::DATABASE_NAME);
     try {
         $conn->begin();
         $obj = UsersPeer::retrieveByPK($usrUid);
         if (!is_object($obj)) {
             throw new RestException(412, G::LoadTranslation('ID_RECORD_DOES_NOT_EXIST'));
         }
         $obj->delete();
         $conn->commit();
     } catch (Exception $e) {
         $conn->rollback();
         throw new RestException(412, $e->getMessage());
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:24,代码来源:Users.php

示例14: executeEdit

 public function executeEdit($request)
 {
     $userId = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', null, 'subscriber');
     $this->miles = true;
     $this->kilo = false;
     if ($userId) {
         $this->user = UsersPeer::retrieveByPK($userId);
     }
     $this->forward404Unless($this->user);
     if ($this->user) {
         $profile = UserProfilePeer::retrieveByPK($this->user->getUserId());
         if ($profile->getMiles() == 1) {
             $this->miles = true;
             $this->kilo = false;
         } else {
             $this->miles = false;
             $this->kilo = true;
         }
     }
     if (!$profile) {
         $profile = new UserProfile();
         $profile->setUserId($this->user->getUserId());
         $profile->setMiles(1);
     }
     $this->user->setUserProfile($profile);
     if ($request->isMethod('post')) {
         $userName = $this->getRequestParameter('userName');
         $fname = $this->getRequestParameter('fname');
         $lname = $this->getRequestParameter('lname');
         $email = $this->getRequestParameter('email');
         $bday = join("/", $this->getRequestParameter('bday'));
         $weight = $this->getRequestParameter('weight');
         $height = $this->getRequestParameter('height');
         $zip = $this->getRequestParameter('zip');
         $units = $this->getRequestParameter('units');
         $country = $this->getRequestParameter('country');
         $city = $this->getRequestParameter('city');
         $state = $this->getRequestParameter('state');
         //        sfContext::getInstance()->getLogger()->info($message);
         //make sure have profile
         if (!$this->user->getUserProfile()) {
             $profile = UserProfilePeer::retrieveByPK($user->getUserId());
             if ($profile) {
                 $this->user->setUserProfile($profile);
             } else {
                 $profile = new UserProfile();
                 $profile->setUserId($user->getUserId());
                 $profile->setMiles(1);
                 $profile->save();
                 $this->user->setUserProfile($profile);
             }
         }
         // pre-populate country, state and city in order to filter select boxes
         $profile = $this->user->getUserProfile();
         //set up profile data
         $profile->setBirthdate($bday);
         $profile->setWeight($weight);
         $profile->setHeight($height);
         $profile->setZip($zip);
         $profile->setCountry($country);
         $profile->setState($state);
         $profile->setCity($city);
         if ($units && count($units) > 0) {
             $u = $units[0];
             if ($u == "kilo") {
                 $profile->setMiles(0);
             } else {
                 $profile->setMiles(1);
             }
         } else {
             $profile->setMiles(1);
         }
         //set up user
         $this->user->setUsername($userName);
         $this->user->setFname($fname);
         $this->user->setLname($lname);
         $this->user->setEmail($email);
         $this->user->setUserProfile($profile);
         $this->user->save();
         $profile->save();
         //set mileage preference
         $this->getUser()->setAttribute('mileage', $profile->getMiles(), 'subscriber');
         return $this->redirect('users/profile');
     }
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:85,代码来源:actions.class.php

示例15: editExtObjectPermission

 /**
  * editObjectPermission
  *
  * @param string $sOP_UID
  * @param string $sProcessUID
  * @return void
  */
 public function editExtObjectPermission($sProcessUID, $sOP_UID)
 {
     $oCriteria = new Criteria();
     $oCriteria->add(ObjectPermissionPeer::OP_UID, $sOP_UID);
     $oDataset = ObjectPermissionPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRows = $oDataset->getRow();
     $oCriteria = new Criteria();
     $oCriteria->add(GroupwfPeer::GRP_UID, $aRows['USR_UID']);
     if (GroupwfPeer::doCount($oCriteria) == 1) {
         $user = '2|' . $aRows['USR_UID'];
     }
     $oCriteria = new Criteria();
     $oCriteria->add(UsersPeer::USR_UID, $aRows['USR_UID']);
     if (UsersPeer::doCount($oCriteria) == 1) {
         $user = '1|' . $aRows['USR_UID'];
     }
     $aFields['LANG'] = SYS_LANG;
     $aFields['OP_UID'] = $aRows['OP_UID'];
     $aFields['PRO_UID'] = $aRows['PRO_UID'];
     $aFields['OP_CASE_STATUS'] = $aRows['OP_CASE_STATUS'];
     $aFields['TAS_UID'] = $aRows['TAS_UID'];
     $aFields['OP_GROUP_USER'] = $user;
     $aFields['OP_TASK_SOURCE'] = $aRows['OP_TASK_SOURCE'];
     $aFields['OP_PARTICIPATE'] = $aRows['OP_PARTICIPATE'];
     $aFields['OP_OBJ_TYPE'] = $aRows['OP_OBJ_TYPE'];
     $aFields['OP_ACTION'] = $aRows['OP_ACTION'];
     $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
     $aFields['TASK_TARGET_NAME'] = Content::load('TAS_TITLE', '', $aRows['TAS_UID'], $lang);
     $aFields['TASK_SOURCE_NAME'] = Content::load('TAS_TITLE', '', $aRows['OP_TASK_SOURCE'], $lang);
     $oUser = UsersPeer::retrieveByPK($aRows['USR_UID']);
     if (!is_null($oUser)) {
         $aFields['USR_FULLNAME'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
     } else {
         throw new Exception("The row '" . $aRows['USR_UID'] . "' in table USER doesn't exist!");
     }
     switch ($aRows['OP_OBJ_TYPE']) {
         /*  case 'ANY':
                 $aFields['OP_OBJ_TYPE'] = '';
                 break;
             */
         case 'DYNAFORM':
             $aFields['DYNAFORM'] = $aRows['OP_OBJ_UID'];
             $aFields['DYNAFORM_NAME'] = Content::load('DYN_TITLE', '', $aRows['OP_OBJ_UID'], $lang);
             break;
         case 'INPUT':
             $aFields['INPUT'] = $aRows['OP_OBJ_UID'];
             $aFields['INPUT_NAME'] = Content::load('INP_DOC_TITLE', '', $aRows['OP_OBJ_UID'], $lang);
             break;
         case 'OUTPUT':
             $aFields['OUTPUT'] = $aRows['OP_OBJ_UID'];
             $aFields['OUTPUT_NAME'] = Content::load('OUT_DOC_TITLE', '', $aRows['OP_OBJ_UID'], $lang);
             break;
     }
     return $aFields;
 }
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:64,代码来源:class.processMap.php


注:本文中的UsersPeer::retrieveByPK方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。