Example #1
0
 /**
  * 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);
     }
 }
Example #2
0
 /**
  * Get the email accounts of the current workspace
  *     
  * return array
  */
 public function getEmailEventAccounts()
 {
     try {
         $criteria = new \Criteria("workflow");
         $criteria->clearSelectColumns();
         $criteria->addSelectColumn(\UsersPeer::USR_UID);
         $criteria->addSelectColumn(\UsersPeer::USR_EMAIL);
         $criteria->addAsColumn('UID', 'USR_UID');
         $criteria->addAsColumn('EMAIL', 'USR_EMAIL');
         $criteria->add(\UsersPeer::USR_STATUS, "ACTIVE");
         $result = \UsersPeer::doSelectRS($criteria);
         $result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $result->next();
         $accountsArray = array();
         while ($aRow = $result->getRow()) {
             if (($aRow['USR_EMAIL'] != null) || ($aRow['USR_EMAIL'] != "")) {
                 $accountsArray[] = array_change_key_case($aRow, CASE_LOWER);
             } 
             $result->next();
         }
         return $accountsArray;
     } catch (\Exception $e) {
         throw $e;
     }
 }
Example #3
0
 public function init()
 {
     parent::init();
     // Verify we're on the correct database
     //print_r(coreConfig::get('database_connection'));exit;
     $connectionInfo = coreConfig::get('database_connection');
     $this->verbose("Using database: %s", $connectionInfo['database']);
     $username = trim($this->getOption('u'));
     $raw_password = trim($this->getOption('p'));
     if (empty($username) || empty($raw_password)) {
         $this->throwError('Username or password is empty.');
     }
     $userid = UsersPeer::getUserId($username);
     if (false === $userid) {
         $this->throwError('User named "%s" not found.', $username);
     }
     $this->verbose("Userid: %s", $userid);
     $this->verbose("Set password to: %s", $raw_password);
     // update user record
     if (false === UsersPeer::updateUser($userid, array('raw_password' => $raw_password))) {
         $this->throwError('Could not update user "%s" (userid %s)', $username, $userid);
     }
     // only with linked PunBB forum
     if ($this->args->flag('forum')) {
         if (coreConfig::get('app_path_to_punbb') !== null) {
             PunBBUsersPeer::setPassword($username, $raw_password);
         } else {
             $this->throwError('Forum password: "app_path_to_punbb" is not defined in environment "%s"', CORE_ENVIRONMENT);
         }
     }
     $this->verbose('Success!');
 }
 public function executeShow()
 {
     $this->users = UsersPeer::retrieveByPk($this->getRequestParameter('id'));
     $c = new Criteria();
     $c->add(RolePeer::ID, $this->users->getRoleId());
     $this->roles = RolePeer::doSelect($c);
     $this->forward404Unless($this->users);
 }
Example #5
0
 private function createUser($username, $raw_password)
 {
     $userinfo = array('username' => $username, 'password' => coreContext::getInstance()->getUser()->getSaltyHashedPassword($raw_password), 'userlevel' => $this->getOption('level', UsersPeer::USERLEVEL_USER), 'email' => trim($this->getOption('email', 'created@localhost')), 'location' => trim($this->getOption('location', 'localhost')));
     //die(print_r($userinfo, true));
     if (false === UsersPeer::createUser($userinfo)) {
         $this->throwError('Could not create user.');
     }
 }
Example #6
0
 /**
  * Updates any column data for given user id.
  *
  * 'raw_password' will be hashed as required and stored into 'password' column.
  * 
  * @param int   $userid
  * @param array $data 
  * @return boolean
  */
 private function updateUser($userid, $data)
 {
     if (isset($data['raw_password'])) {
         $data['password'] = coreContext::getInstance()->getUser()->getSaltyHashedPassword($data['raw_password']);
         unset($data['raw_password']);
     }
     if (false === UsersPeer::updateUser($userid, $data)) {
         $this->throwError('Could not update user id %s', $userid);
     }
     return true;
 }
Example #7
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $uid = $this->getRequestParameter('uid');
     $conf = $this->getRequestParameter('conf');
     $c = new Criteria();
     $c->add(UsersPeer::USER_ID, $uid);
     $user = UsersPeer::doSelectOne($c);
     if (sha1($user->getSalt() . $user->getUsername()) == $conf) {
         $this->goodConf = true;
         $user->setActive('Y');
         $user->save();
     } else {
         $this->goodConf = false;
     }
 }
 public function executeLogin()
 {
     $c = new Criteria();
     $c->add(UsersPeer::USER_NAME, $this->getRequestParameter('login'));
     $c->add(UsersPeer::USER_PWD, $this->getRequestParameter('password'));
     $user_record = UsersPeer::doSelectOne($c);
     if ($user_record) {
         $this->getUser()->setAuthenticated(true);
         $c = new Criteria();
         $c->add(RolePeer::ID, $user_record->getRoleId());
         $user_role = RolePeer::doSelectOne($c);
         $this->getUser()->addCredential($user_role->getRoleName());
         return $this->redirect('users');
     } else {
         $this->getRequest()->setError('login', 'incorrect entry');
         return $this->forward('security', 'index');
     }
 }
Example #9
0
 /**
  * Sign In form.
  * 
  * @return 
  */
 public function executeLogin($request)
 {
     if ($request->getMethod() != coreRequest::POST) {
         // get the referer option from redirectToLogin()
         $referer = $this->getUser()->getAttribute('login_referer', '');
         // get other options from redirectToLogin()
         $username = $this->getUser()->getAttribute('login_username', '');
         // clear redirectToLogin() options
         $this->getUser()->getAttributeHolder()->remove('login_referer');
         $this->getUser()->getAttributeHolder()->remove('login_username');
         $this->getRequest()->setParameter('referer', empty($referer) ? '@homepage' : $referer);
         $this->getRequest()->setParameter('username', $username);
         // AUTO FILL FORM (DEVELOPMENT ONLY!)
         if (CORE_ENVIRONMENT === 'dev') {
             $request->getParameterHolder()->add(array('username' => 'guest', 'password' => ''));
         }
     } else {
         $validator = new coreValidator($this->getActionName());
         if ($validator->validate($request->getParameterHolder()->getAll())) {
             $username = trim($request->getParameter('username'));
             $raw_password = trim($request->getParameter('password'));
             $rememberme = $request->hasParameter('rememberme');
             // check that user exists and password matches
             $user = UsersPeer::getUser($username);
             if (!$user || $this->getUser()->getSaltyHashedPassword($raw_password) != $user['password']) {
                 $request->setError('login_invalid', "Invalid username and/or password.");
                 return;
             }
             // sign in user
             $this->getUser()->signIn($user);
             // optionally, create the remember me cookie
             if ($rememberme) {
                 $this->getUser()->setRememberMeCookie($user['username'], $this->getUser()->getSaltyHashedPassword($raw_password));
             }
             // authenticate user on the community forums
             if (coreContext::getInstance()->getConfiguration()->getEnvironment() !== 'staging' && coreConfig::get('app_path_to_punbb') !== null) {
                 PunBBUsersPeer::signIn($username, $raw_password, $rememberme);
             }
             // succesfully signed in
             return $this->redirect($this->getRequestParameter('referer', '@homepage'));
         }
     }
 }
Example #10
0
 public function executeIndex($request)
 {
     $username = $request->getParameter('username');
     if (!$username) {
         if ($this->getUser()->isAuthenticated()) {
             $username = $this->getUser()->getUserName();
         } else {
             // if unauthenticated user checks his (bookmarked?) profile, go to login and back
             $url = $this->getController()->genUrl('profile/index', true);
             $this->getUser()->redirectToLogin(array('referer' => $url));
         }
     }
     if ($user = UsersPeer::getUser($username)) {
         $this->user = $user;
         $this->self_account = $user['username'] == $this->getUser()->getUserName();
         $this->kanji_count = ReviewsPeer::getReviewedFlashcardCount($user['userid']);
         $this->total_reviews = ReviewsPeer::getTotalReviews($user['userid']);
         $this->forum_uid = coreConfig::get('app_path_to_punbb') !== null ? PunBBUsersPeer::getInstance()->getForumUID($username) : false;
         return coreView::SUCCESS;
     }
     return coreView::ERROR;
 }
Example #11
0
 function adhocAssignUsersk($params)
 {
     G::LoadClass('groups');
     G::LoadClass('tasks');
     $oTasks = new Tasks();
     $aAux = $oTasks->getGroupsOfTask($_SESSION['TASK'], 2);
     $aAdhocUsers = array();
     $oGroups = new Groups();
     foreach ($aAux as $aGroup) {
         $aUsers = $oGroups->getUsersOfGroup($aGroup['GRP_UID']);
         foreach ($aUsers as $aUser) {
             if ($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
                 $aAdhocUsers[] = $aUser['USR_UID'];
             }
         }
     }
     $aAux = $oTasks->getUsersOfTask($_SESSION['TASK'], 2);
     foreach ($aAux as $aUser) {
         if ($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
             $aAdhocUsers[] = $aUser['USR_UID'];
         }
     }
     require_once 'classes/model/Users.php';
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(UsersPeer::USR_UID);
     $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
     $oCriteria->add(UsersPeer::USR_UID, $aAdhocUsers, Criteria::IN);
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $aData = array();
     while ($oDataset->next()) {
         $aData[] = $oDataset->getRow();
     }
     $this->data = $aData;
 }
Example #12
0
    /**

     * reassign Case

     *

     * @param string sessionId : The session ID (which was obtained during login)

     * @param string caseId : The case ID (which can be obtained with the caseList() function)

     * @param string delIndex : The delegation index number of the case (which can be obtained with the caseList()

     * function).

     * @param string userIdSource : The user who is currently assigned the case.

     * @param string userIdTarget : The target user who will be newly assigned to the case.

     * @return $result will return an object

     */

    public function reassignCase ($sessionId, $caseId, $delIndex, $userIdSource, $userIdTarget)

    {

        $g = new G();



        try {

            $g->sessionVarSave();



            $_SESSION["APPLICATION"] = $caseId;

            $_SESSION["INDEX"] = $delIndex;

            $_SESSION["USER_LOGGED"] = $userIdSource;



            if ($userIdTarget == $userIdSource) {

                $result = new wsResponse( 30, G::loadTranslation( 'ID_TARGET_ORIGIN_USER_SAME' ) );



                $g->sessionVarRestore();



                return $result;

            }



            /**

             * ****************( 1 )*****************

             */

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );

            $oCriteria->add( UsersPeer::USR_UID, $userIdSource );

            $oDataset = UsersPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $aRow = $oDataset->getRow();



            if (! is_array( $aRow )) {

                $result = new wsResponse( 31, G::loadTranslation( 'ID_INVALID_ORIGIN_USER' ) );



                $g->sessionVarRestore();



                return $result;

            }



            /**

             * ****************( 2 )*****************

             */

            $oCase = new Cases();

            $rows = $oCase->loadCase( $caseId );



            if (! is_array( $aRow )) {

                $result = new wsResponse( 32, G::loadTranslation( 'ID_CASE_NOT_OPEN' ) );



                $g->sessionVarRestore();



                return $result;

            }



            /**

             * ****************( 3 )*****************

             */

            $oCriteria = new Criteria( 'workflow' );

            $aConditions = array ();

            // $aConditions[] = array(AppDelegationPeer::USR_UID, TaskUserPeer::USR_UID);

            // $aConditions[] = array(AppDelegationPeer::TAS_UID, TaskUserPeer::TAS_UID);

            // $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);

            //$oCriteria->addJoin(AppDelegationPeer::USR_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN);

            $oCriteria->add( AppDelegationPeer::APP_UID, $caseId );

            $oCriteria->add( AppDelegationPeer::USR_UID, $userIdSource );

            $oCriteria->add( AppDelegationPeer::DEL_INDEX, $delIndex );

            $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );

            $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $aRow = $oDataset->getRow();



            if (! is_array( $aRow )) {

                $result = new wsResponse( 33, G::loadTranslation( 'ID_INVALID_CASE_DELEGATION_INDEX' ) );



                $g->sessionVarRestore();



                return $result;

            }



            $tasUid = $aRow['TAS_UID'];

            $derivation = new Derivation();

            $userList = $derivation->getAllUsersFromAnyTask($tasUid, true);



            if (! in_array( $userIdTarget, $userList )) {

                $result = new wsResponse( 34, G::loadTranslation( 'ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS' ) );



                $g->sessionVarRestore();



                return $result;

            }



            /**

             * ****************( 4 )*****************

             */

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );

            $oCriteria->add( UsersPeer::USR_UID, $userIdTarget );

            $oDataset = UsersPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $aRow = $oDataset->getRow();



            if (! is_array( $aRow )) {

                $result = new wsResponse( 35, G::loadTranslation( 'ID_TARGET_USER_DESTINATION_INVALID' ) );



                $g->sessionVarRestore();



                return $result;

            }



            /**

             * ****************( 5 )*****************

             */

            $var = $oCase->reassignCase( $caseId, $delIndex, $userIdSource, $userIdTarget );



            if (! $var) {

                $result = new wsResponse( 36, G::loadTranslation( 'ID_CASE_COULD_NOT_REASSIGNED' ) );



                $g->sessionVarRestore();



                return $result;

            }



            $result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ) );



            $g->sessionVarRestore();



            return $result;

        } catch (Exception $e) {

            $result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()

            );



            $g->sessionVarRestore();



            return $result;

        }

    }
Example #13
0
    /**
     * Create List Completed Table
     *
     * @param type $data
     * @return type
     *
     */
    public function create($data)
    {
        $criteria = new Criteria();
        $criteria->addSelectColumn(ListCompletedPeer::APP_UID);
        $criteria->add( ListCompletedPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
        $dataset = ListCompletedPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        if ($dataset->next()) {
            return 1;
        }

        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_TITLE'] = $aRow['CON_VALUE'];


        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_PRO_TITLE'] = $aRow['CON_VALUE'];


        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_TAS_TITLE'] = $aRow['CON_VALUE'];


        $criteria = new Criteria();
        $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
        $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
        $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
        $criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL );
        $dataset = UsersPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['DEL_CURRENT_USR_USERNAME']  = $aRow['USR_USERNAME'];
        $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
        $data['DEL_CURRENT_USR_LASTNAME']  = $aRow['USR_LASTNAME'];
        $data['DEL_PREVIOUS'] = isset($data['DEL_PREVIOUS']) ? $data['DEL_PREVIOUS'] : "";

        if ($data['DEL_PREVIOUS'] != 0) {
            $criteria = new Criteria();
            $criteria->addSelectColumn(AppDelegationPeer::USR_UID);
            $criteria->add( AppDelegationPeer::DEL_INDEX, $data['DEL_PREVIOUS'], Criteria::EQUAL );
            $dataset = UsersPeer::doSelectRS($criteria);
            $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $dataset->next();
            $aRow = $dataset->getRow();
            $data['DEL_PREVIOUS_USR_UID']  = $aRow['USR_UID'];
        }

        //Update - WHERE
        $criteriaWhere = new Criteria("workflow");
        $criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL);
        //Update - SET
        $criteriaSet = new Criteria("workflow");
        $criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, 'COMPLETED');
        BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));

        $users = new Users();
        $users->refreshTotal($data['USR_UID'], 'add', 'completed');
        if ($data['DEL_PREVIOUS'] != 0) {
            $criteria = new Criteria();
            $criteria->addSelectColumn(TaskPeer::TAS_TYPE);
            $criteria->add( TaskPeer::TAS_UID, $data['TAS_UID'], Criteria::EQUAL );
            $dataset = TaskPeer::doSelectRS($criteria);
            $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $dataset->next();
            $aRow = $dataset->getRow();
            if ($aRow['TAS_TYPE'] != 'SUBPROCESS') {
                $users->refreshTotal($data['USR_UID'], 'remove', 'inbox');
            }
        } else {
            $criteria = new Criteria();
            $criteria->addSelectColumn(SubApplicationPeer::APP_UID);
            $criteria->add( SubApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
            $dataset = SubApplicationPeer::doSelectRS($criteria);
            $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            if ($dataset->next()) {
                $users->refreshTotal($data['USR_UID'], 'remove', 'inbox');
            } else {
                $users->refreshTotal($data['USR_UID'], 'remove', 'draft');
            }
        }

        $con = Propel::getConnection( ListCompletedPeer::DATABASE_NAME );
        try {
            $this->fromArray( $data, BasePeer::TYPE_FIELDNAME );
            if ($this->validate()) {
                $result = $this->save();
            } else {
                $e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
                $e->aValidationFailures = $this->getValidationFailures();
                throw ($e);
            }
            $con->commit();
            return $result;
        } catch(Exception $e) {
            $con->rollback();
            throw ($e);
        }
    }
Example #14
0
 /**
  * Return Select object for the active members list.
  * 
  * @param
  * @return coreDatabaseSelect
  */
 public static function getSelectForActiveMembersList()
 {
     return self::getInstance()->select(array(self::getInstance()->getName() . '.userid', 'username', 'location', 'fc_count', 'ts_lastreview' => 'UNIX_TIMESTAMP(last_review)'))->joinUsing(UsersPeer::getInstance()->getName(), 'userid');
 }
Example #15
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = UsersPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setUsrUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setUsrUsername($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setUsrPassword($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setUsrFirstname($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setUsrLastname($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setUsrEmail($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setUsrDueDate($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setUsrCreateDate($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setUsrUpdateDate($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setUsrStatus($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setUsrCountry($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setUsrCity($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setUsrLocation($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setUsrAddress($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setUsrPhone($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setUsrFax($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setUsrCellular($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setUsrZipCode($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setDepUid($arr[$keys[18]]);
     }
     if (array_key_exists($keys[19], $arr)) {
         $this->setUsrPosition($arr[$keys[19]]);
     }
     if (array_key_exists($keys[20], $arr)) {
         $this->setUsrResume($arr[$keys[20]]);
     }
     if (array_key_exists($keys[21], $arr)) {
         $this->setUsrBirthday($arr[$keys[21]]);
     }
     if (array_key_exists($keys[22], $arr)) {
         $this->setUsrRole($arr[$keys[22]]);
     }
     if (array_key_exists($keys[23], $arr)) {
         $this->setUsrReportsTo($arr[$keys[23]]);
     }
     if (array_key_exists($keys[24], $arr)) {
         $this->setUsrReplacedBy($arr[$keys[24]]);
     }
     if (array_key_exists($keys[25], $arr)) {
         $this->setUsrUx($arr[$keys[25]]);
     }
     if (array_key_exists($keys[26], $arr)) {
         $this->setUsrTotalInbox($arr[$keys[26]]);
     }
     if (array_key_exists($keys[27], $arr)) {
         $this->setUsrTotalDraft($arr[$keys[27]]);
     }
     if (array_key_exists($keys[28], $arr)) {
         $this->setUsrTotalCancelled($arr[$keys[28]]);
     }
     if (array_key_exists($keys[29], $arr)) {
         $this->setUsrTotalParticipated($arr[$keys[29]]);
     }
     if (array_key_exists($keys[30], $arr)) {
         $this->setUsrTotalPaused($arr[$keys[30]]);
     }
     if (array_key_exists($keys[31], $arr)) {
         $this->setUsrTotalCompleted($arr[$keys[31]]);
     }
     if (array_key_exists($keys[32], $arr)) {
         $this->setUsrTotalUnassigned($arr[$keys[32]]);
     }
     if (array_key_exists($keys[33], $arr)) {
         $this->setUsrCostByHour($arr[$keys[33]]);
     }
     if (array_key_exists($keys[34], $arr)) {
         $this->setUsrUnitCost($arr[$keys[34]]);
     }
     if (array_key_exists($keys[35], $arr)) {
         $this->setUsrPmdriveFolderUid($arr[$keys[35]]);
     }
     if (array_key_exists($keys[36], $arr)) {
         $this->setUsrBookmarkStartCases($arr[$keys[36]]);
     }
     if (array_key_exists($keys[37], $arr)) {
         $this->setUsrTimeZone($arr[$keys[37]]);
     }
     if (array_key_exists($keys[38], $arr)) {
         $this->setUsrDefaultLang($arr[$keys[38]]);
     }
 }
Example #16
0
 /**
  * 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;
 }
$sWS_USER = trim($_REQUEST['USERNAME']);
$sWS_PASS = trim($_REQUEST['PASSWORD']);
if (G::is_https()) {
    $http = 'https://';
} else {
    $http = 'http://';
}
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
@($client = new SoapClient($endpoint));
$user = $sWS_USER;
$pass = $sWS_PASS;
$params = array('userid' => $user, 'password' => $pass);
$result = $client->__SoapCall('login', array($params));
$fields['status_code'] = $result->status_code;
$fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message;
$fields['version'] = $result->version;
$fields['time_stamp'] = $result->timestamp;
$messageCode = $result->message;
if ($result->status_code == 0) {
    if (!class_exists('Users')) {
        require "classes/model/UsersPeer.php";
    }
    $oCriteria = new Criteria('workflow');
    $oCriteria->addSelectColumn('USR_UID');
    $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER);
    $resultSet = UsersPeer::doSelectRS($oCriteria);
    $resultSet->next();
    $user_id = $resultSet->getRow();
    $messageCode = $user_id[0];
}
echo $messageCode;
Example #18
0
 /**
  * Return a list of adhoc assignees of an activity
  *
  * @param string $sProcessUID {@min 32} {@max 32}
  * @param string $sTaskUID {@min 32} {@max 32}
  * @param string $filter
  * @param int    $start
  * @param int    $limit
  * @param string $type
  *
  * return array
  *
  * @access public
  */
 public function getTaskAdhocAssigneesAll($sProcessUID, $sTaskUID, $filter, $start, $limit, $type)
 {
     try {
         Validator::proUid($sProcessUID, '$prj_uid');
         $this->validateActUid($sTaskUID);
         $aUsers = array();
         $oTasks = new \Tasks();
         $aAux = $oTasks->getGroupsOfTask($sTaskUID, 2);
         $aGroupUids = array();
         foreach ($aAux as $aGroup) {
             $aGroupUids[] = $aGroup['GRP_UID'];
         }
         foreach ($aGroupUids as $results) {
             $oCriteria = new \Criteria('workflow');
             $oCriteria->addSelectColumn('USR_UID');
             $oCriteria->add(\GroupUserPeer::GRP_UID, $results);
             $oGroupDataset = \GroupUserPeer::doSelectRS($oCriteria);
             $oGroupDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
             while ($oGroupDataset->next()) {
                 $aGroupRow = $oGroupDataset->getRow();
                 $oGroupCriteria = new \Criteria('workflow');
                 $oGroupCriteria->addSelectColumn(\UsersPeer::USR_UID);
                 $oGroupCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
                 $oGroupCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
                 $oGroupCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
                 if ($filter != '') {
                     $oGroupCriteria->add($oGroupCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, "%{$filter}%", \Criteria::LIKE)->addOr($oGroupCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, "%{$filter}%", \Criteria::LIKE))->addOr($oGroupCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME, "%{$filter}%", \Criteria::LIKE)));
                 }
                 $oGroupCriteria->add(\UsersPeer::USR_UID, $aGroupRow["USR_UID"]);
                 $oUserDataset = \UsersPeer::doSelectRS($oGroupCriteria);
                 $oUserDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
                 $oUserDataset->next();
                 while ($aUserRow = $oUserDataset->getRow()) {
                     $aUsers[] = array('aas_uid' => $aUserRow['USR_UID'], 'aas_name' => $aUserRow['USR_FIRSTNAME'], 'aas_lastname' => $aUserRow['USR_LASTNAME'], 'aas_username' => $aUserRow['USR_USERNAME'], 'aas_type' => "user");
                     $oUserDataset->next();
                 }
             }
         }
         $oCriteria = new \Criteria('workflow');
         $oCriteria->addSelectColumn(\UsersPeer::USR_UID);
         $oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
         $oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
         $oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
         if ($filter != '') {
             $oCriteria->add($oCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, "%{$filter}%", \Criteria::LIKE)->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, "%{$filter}%", \Criteria::LIKE))->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME, "%{$filter}%", \Criteria::LIKE)));
         }
         $oCriteria->addJoin(\TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
         $oCriteria->add(\TaskUserPeer::TAS_UID, $sTaskUID);
         $oCriteria->add(\TaskUserPeer::TU_TYPE, 2);
         $oCriteria->add(\TaskUserPeer::TU_RELATION, 1);
         $oDataset = \TaskUserPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             if ($type == '' || $type == 'user') {
                 $aUsers[] = array('aas_uid' => $aRow['USR_UID'], 'aas_name' => $aRow['USR_FIRSTNAME'], 'aas_lastname' => $aRow['USR_LASTNAME'], 'aas_username' => $aRow['USR_USERNAME'], 'aas_type' => "user");
             }
             $oDataset->next();
         }
         $aUsersGroups = array();
         $exclude = array("");
         for ($i = 0; $i <= count($aUsers) - 1; $i++) {
             if (!in_array(trim($aUsers[$i]["aas_uid"]), $exclude)) {
                 $aUsersGroups[] = $aUsers[$i];
                 $exclude[] = trim($aUsers[$i]["aas_uid"]);
             }
         }
         if ($start) {
             if ($start < 0) {
                 throw new \Exception(\G::LoadTranslation("ID_INVALID_START"));
             }
         } else {
             $start = 0;
         }
         if (isset($limit)) {
             if ($limit < 0) {
                 throw new \Exception(\G::LoadTranslation("ID_INVALID_LIMIT"));
             } else {
                 if ($limit == 0) {
                     return array();
                 }
             }
         } else {
             $limit = count($aUsersGroups) + 1;
         }
         $aUsersGroups = $this->arrayPagination($aUsersGroups, $start, $limit);
         return $aUsersGroups;
     } catch (\Exception $e) {
         throw $e;
     }
 }
Example #19
0
    public function newRow ($data, $delPreviusUsrUid, $isInitSubprocess = false, $dataPreviusApplication = array(), $isSelfService = false)
    {
        $removeList = true;
        if (isset($data['REMOVED_LIST'])) {
            $removeList = $data['REMOVED_LIST'];
            unset($data['REMOVED_LIST']);
        }
        $data['DEL_PREVIOUS_USR_UID'] = $delPreviusUsrUid;
        if (isset($data['DEL_TASK_DUE_DATE'])) {
            $data['DEL_DUE_DATE'] = $data['DEL_TASK_DUE_DATE'];
        }

        $criteria = new Criteria();
        $criteria->addSelectColumn( ApplicationPeer::APP_NUMBER );
        $criteria->addSelectColumn( ApplicationPeer::APP_UPDATE_DATE );
        $criteria->add( ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
        $dataset = ApplicationPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data = array_merge($data, $aRow);


        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_TITLE'] = $aRow['CON_VALUE'];


        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_PRO_TITLE'] = $aRow['CON_VALUE'];


        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_TAS_TITLE'] = $aRow['CON_VALUE'];


        $data['APP_PREVIOUS_USER'] = '';
        if ($data['DEL_PREVIOUS_USR_UID'] != '') {
            $criteria = new Criteria();
            $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
            $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
            $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
            $criteria->add( UsersPeer::USR_UID, $data['DEL_PREVIOUS_USR_UID'], Criteria::EQUAL );
            $dataset = UsersPeer::doSelectRS($criteria);
            $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $dataset->next();
            $aRow = $dataset->getRow();
            $data['DEL_PREVIOUS_USR_USERNAME']  = $aRow['USR_USERNAME'];
            $data['DEL_PREVIOUS_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
            $data['DEL_PREVIOUS_USR_LASTNAME']  = $aRow['USR_LASTNAME'];
        }

        $users = new Users();
        $criteria = new Criteria();
        $criteria->addSelectColumn(SubApplicationPeer::DEL_INDEX_PARENT);
        $criteria->add( SubApplicationPeer::APP_PARENT, $data['APP_UID'], Criteria::EQUAL );
        $dataset = SubApplicationPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        if ($dataset->next()) {
            $aSub = $dataset->getRow();
            if ($aSub['DEL_INDEX_PARENT'] == $data['DEL_PREVIOUS'] && !$isSelfService) {
                $users->refreshTotal($data['USR_UID'], 'add', 'inbox');
                self::create($data, $isSelfService);
                return 1;
            }
        }

        if (!$isInitSubprocess) {
            if ($data['APP_STATUS'] == 'DRAFT') {
                $users->refreshTotal($data['USR_UID'], 'add', 'draft');
            } else {
                $oRow = ApplicationPeer::retrieveByPK($data['APP_UID']);
                $aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
                if ($removeList) {
                    if ($data['DEL_INDEX'] == 2 || $aFields['APP_STATUS'] == 'DRAFT') {
                        $criteria = new Criteria();
                        $criteria->addSelectColumn(SubApplicationPeer::APP_UID);
                        $criteria->add( SubApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
                        $dataset = SubApplicationPeer::doSelectRS($criteria);
                        if ($dataset->next()) {
                            $users->refreshTotal($delPreviusUsrUid, 'remove', 'inbox');
                        } else {
                            $users->refreshTotal($delPreviusUsrUid, 'remove', 'draft');
                        }
                    } else {
                        $users->refreshTotal($delPreviusUsrUid, 'remove', 'inbox');
                    }
                }
                if (!$isSelfService) {
                    $users->refreshTotal($data['USR_UID'], 'add', 'inbox');
                }
            }
        } else {
            if($data['USR_UID'] !=''){
                $users->refreshTotal($data['USR_UID'], 'add', 'inbox');
            }
            if ($dataPreviusApplication['APP_STATUS'] == 'DRAFT') {
                $users->refreshTotal($dataPreviusApplication['CURRENT_USER_UID'], 'remove', 'draft');
            } else {
                $users->refreshTotal($dataPreviusApplication['CURRENT_USER_UID'], 'remove', 'inbox');
            }
        }
        self::create($data, $isSelfService);
    }
Example #20
0
    /**
     * Create List Paused Table
     *
     * @param type $data
     * @return type
     *
     */
    public function create($data)
    {
        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_TITLE'] = $aRow['CON_VALUE'];

        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_PRO_TITLE'] = $aRow['CON_VALUE'];

        $criteria = new Criteria();
        $criteria->addSelectColumn(AppDelegationPeer::USR_UID);
        $criteria->addSelectColumn(AppDelegationPeer::TAS_UID);
        $criteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
        $criteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
        $criteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
        $criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
        $criteria->add( AppDelegationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
        $criteria->add( AppDelegationPeer::DEL_INDEX, $data['DEL_INDEX'], Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['USR_UID'] = isset($data['USR_UID']) ? $data['USR_UID'] : $aRow['USR_UID'];
        $data['TAS_UID'] = $aRow['TAS_UID'];
        $data['DEL_INIT_DATE'] = $aRow['DEL_INIT_DATE'];
        $data['DEL_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE'];
        $data['DEL_DELEGATE_DATE'] = $aRow['DEL_DELEGATE_DATE'];
        $delPrevious = $aRow['DEL_PREVIOUS'];

        $criteria = new Criteria();
        $criteria->addSelectColumn(AppDelegationPeer::USR_UID);
        $criteria->add( AppDelegationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
        $criteria->add( AppDelegationPeer::DEL_INDEX, $delPrevious, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['DEL_PREVIOUS_USR_UID'] = $aRow['USR_UID'];

        $criteria = new Criteria();
        $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
        $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
        $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
        $criteria->add( UsersPeer::USR_UID, $data['DEL_PREVIOUS_USR_UID'], Criteria::EQUAL );
        $dataset = UsersPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['DEL_PREVIOUS_USR_USERNAME']  = $aRow['USR_USERNAME'];
        $data['DEL_PREVIOUS_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
        $data['DEL_PREVIOUS_USR_LASTNAME']  = $aRow['USR_LASTNAME'];

        $criteria = new Criteria();
        $criteria->addSelectColumn(ContentPeer::CON_VALUE);
        $criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL );
        $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
        $dataset = ContentPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['APP_TAS_TITLE'] = $aRow['CON_VALUE'];

        $criteria = new Criteria();
        $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
        $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
        $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
        $criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL );
        $dataset = UsersPeer::doSelectRS($criteria);
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $dataset->next();
        $aRow = $dataset->getRow();
        $data['DEL_CURRENT_USR_USERNAME']  = $aRow['USR_USERNAME'];
        $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
        $data['DEL_CURRENT_USR_LASTNAME']  = $aRow['USR_LASTNAME'];

        $data['APP_PAUSED_DATE'] = Date("Y-m-d H:i:s");

        $oListInbox = new ListInbox();
        $oListInbox->remove($data['APP_UID'], $data['DEL_INDEX']);

        $users = new Users();
        if ($data['APP_STATUS'] == 'DRAFT') {
            $users->refreshTotal($data['USR_UID'], 'removed', 'draft');
        } else {
            $users->refreshTotal($data['USR_UID'], 'removed', 'inbox');
        }
        $users->refreshTotal($data['USR_UID'], 'add', 'paused');

        $con = Propel::getConnection( ListPausedPeer::DATABASE_NAME );
        try {
            $this->fromArray( $data, BasePeer::TYPE_FIELDNAME );
            if ($this->validate()) {
                $result = $this->save();
            } else {
                $e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
                $e->aValidationFailures = $this->getValidationFailures();
                throw ($e);
            }
            $con->commit();
            return $result;
        } catch(Exception $e) {
            $con->rollback();
            throw ($e);
        }
    }
Example #21
0
    public function userNameFormat($username, $fullname, $usrUid = '')
    {
        $aux = '';
        if ($usrUid != '') {
            $oUser = UsersPeer::retrieveByPK($usrUid);
            $aux = str_replace('@userName', trim($username), $this->UserConfig['format']);

            $theFormat = $this->UserConfig['format'];
            $fname = $oUser->getUsrFirstname();
            $lname = $oUser->getUsrLastname();
            if (strpos($theFormat, ',') !== false && ( trim($fname) == '' || trim($lname) == '')) {
              $theFormat = str_replace(',', '', $theFormat);
            }

            $aux = str_replace('@userName', trim($username), $theFormat);
            $aux = str_replace('@firstName', $oUser->getUsrFirstname(), $aux);
            $aux = str_replace('@lastName', $oUser->getUsrLastname(), $aux);           
        }
        return $aux;
    }
Example #22
0
 function getAllUsersByDepartment()
 {
     $oCriteria = new Criteria('rbac');
     $oCriteria->addSelectColumn(UsersPeer::DEP_UID);
     $oCriteria->addSelectColumn('COUNT(*) AS CNT');
     $oCriteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
     $oCriteria->addGroupByColumn(UsersPeer::DEP_UID);
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $aDepts = array();
     while ($oDataset->next()) {
         $row = $oDataset->getRow();
         $aDepts[$row['DEP_UID']] = $row['CNT'];
     }
     return $aDepts;
 }
Example #23
0
 *
 */
try {
    global $RBAC;
    if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
        G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
        G::header('location: ../login/login');
        die;
    }
    switch ($_REQUEST['action']) {
        case 'searchUsers':
            require_once 'classes/model/Users.php';
            $criteria = new Criteria('workflow');
            $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
            $criteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
            $dataset = UsersPeer::DoSelectRs($criteria);
            $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $dataset->next();
            $pmUsers = array();
            while ($row = $dataset->getRow()) {
                $pmUsers[] = $row['USR_USERNAME'];
                $dataset->next();
            }
            $aFields = $RBAC->getAuthSource($_POST['sUID']);
            G::LoadThirdParty('pear/json', 'class.json');
            $oJSON = new Services_JSON();
            $i = 0;
            $oUser = new Users();
            $aAux = $RBAC->searchUsers($_POST['sUID'], $_POST['sKeyword']);
            $aUsers = array();
            // note added by gustavo cruz gustavo-at-colosa.com
    /**
     * Refresh List Participated Last
     *
     * @param type $seqName
     * @return type
     * @throws type
     *
     */
    public function refresh ($data, $isSelfService = false)
    {
        $data['APP_STATUS'] = (empty($data['APP_STATUS'])) ? 'TO_DO' : $data['APP_STATUS'];
        if (!$isSelfService) {
            if ($data["USR_UID"] == "") {
                return;
            }

            $criteria = new Criteria();
            $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
            $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
            $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
            $criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL );
            $dataset = UsersPeer::doSelectRS($criteria);
            $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $dataset->next();
            $aRow = $dataset->getRow();

            //Update - WHERE
            $criteriaWhere = new Criteria("workflow");
            $criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL);
            //Update - SET
            $criteriaSet = new Criteria("workflow");
            $criteriaSet->add(ListParticipatedLastPeer::DEL_CURRENT_USR_USERNAME, $aRow['USR_USERNAME']);
            $criteriaSet->add(ListParticipatedLastPeer::DEL_CURRENT_USR_FIRSTNAME, $aRow['USR_FIRSTNAME']);
            $criteriaSet->add(ListParticipatedLastPeer::DEL_CURRENT_USR_LASTNAME, $aRow['USR_LASTNAME']);
            BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));

        }
        $this->update($data);

    }
Example #25
0
    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 '';

            }

        }

    }
Example #26
0
 /**
  * Refresh List My Inbox
  *
  * @param type $seqName
  * @return type
  * @throws type
  *
  */
 public function refresh($data)
 {
     $data['APP_STATUS'] = empty($data['APP_STATUS']) ? 'TO_DO' : $data['APP_STATUS'];
     $criteria = new Criteria();
     $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
     $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
     $criteria->add(UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL);
     $dataset = UsersPeer::doSelectRS($criteria);
     $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $dataset->next();
     $aRow = $dataset->getRow();
     $data['DEL_CURRENT_USR_UID'] = $data['USR_UID'];
     $data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME'];
     $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
     $data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME'];
     if ($data['DEL_INDEX'] == 1 && $data['APP_STATUS'] == 'TO_DO') {
         $data['APP_CREATE_DATE'] = $data['APP_UPDATE_DATE'];
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ListMyInboxPeer::APP_UID, $data['APP_UID']);
         $oCriteria->add(ListMyInboxPeer::USR_UID, $data['USR_UID']);
         ListMyInboxPeer::doDelete($oCriteria);
         $this->create($data);
     } else {
         unset($data['USR_UID']);
         $this->update($data);
     }
 }
Example #27
0
     $gif = '<img width="13" height="13" border="0" src="' . $img . '">';
     $aFields['DESCRIPTION'] = $span . $gif . $aFields['DESCRIPTION'];
     print G::json_encode($aFields);
     break;
 case 'testUsername':
     require_once 'classes/model/Users.php';
     $_POST['NEW_USERNAME'] = trim($_POST['NEW_USERNAME']);
     $USR_UID = isset($_POST['USR_UID']) ? $_POST['USR_UID'] : '';
     $response = array("success" => true);
     $oCriteria = new Criteria();
     $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
     $oCriteria->add(UsersPeer::USR_USERNAME, utf8_encode($_POST['NEW_USERNAME']));
     if ($USR_UID != '') {
         $oCriteria->add(UsersPeer::USR_UID, array($_POST['USR_UID']), Criteria::NOT_IN);
     }
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     if (is_array($aRow) || $_POST['NEW_USERNAME'] == '') {
         $color = 'red';
         $img = '/images/delete.png';
         $dataVar['USER_ID'] = $_POST['NEW_USERNAME'];
         $text = G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', $dataVar);
         $text = $_POST['NEW_USERNAME'] == '' ? G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME') : $text;
         $response['exists'] = true;
     } else {
         $color = 'green';
         $img = '/images/dialog-ok-apply.png';
         $text = G::LoadTranslation('ID_USERNAME_CORRECT');
         $response['exists'] = false;
Example #28
0
    public function getUsersToReassign($TAS_UID, $USR_UID, $PRO_UID=null)

    {

        G::LoadClass('groups');

        G::LoadClass('tasks');



        $oTasks = new Tasks();

        $aAux = $oTasks->getGroupsOfTask($TAS_UID, 1);

        $row = array();

        $groups = new Groups();

        foreach ($aAux as $aGroup) {

            $aUsers = $groups->getUsersOfGroup($aGroup['GRP_UID']);

            foreach ($aUsers as $aUser) {

                if ($aUser['USR_UID'] != $USR_UID) {

                    $row[] = $aUser['USR_UID'];

                }

            }

        }



        $aAux = $oTasks->getUsersOfTask($TAS_UID, 1);

        foreach ($aAux as $aUser) {

            if ($aUser['USR_UID'] != $USR_UID) {

                $row[] = $aUser['USR_UID'];

            }

        }



        // Group Ad Hoc

        $oTasks = new Tasks();

        $aAux = $oTasks->getGroupsOfTask($TAS_UID, 2);

        $groups = new Groups();

        foreach ($aAux as $aGroup) {

            $aUsers = $groups->getUsersOfGroup($aGroup['GRP_UID']);

            foreach ($aUsers as $aUser) {

                if ($aUser['USR_UID'] != $USR_UID) {

                    $row[] = $aUser['USR_UID'];

                }

            }

        }



        // User Ad Hoc

        $aAux = $oTasks->getUsersOfTask($TAS_UID, 2);

        foreach ($aAux as $aUser) {

            if ($aUser['USR_UID'] != $USR_UID) {

                $row[] = $aUser['USR_UID'];

            }

        }



        global $RBAC;

        //Adding the actual user if this has the PM_SUPERVISOR permission assigned.

        if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) {

            if(!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) {

                $row[] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];

            }

        }



        $c = new Criteria('workflow');

        $c->addSelectColumn(UsersPeer::USR_UID);

        $c->addSelectColumn(UsersPeer::USR_USERNAME);

        $c->addSelectColumn(UsersPeer::USR_FIRSTNAME);

        $c->addSelectColumn(UsersPeer::USR_LASTNAME);

        $c->add(UsersPeer::USR_UID, $row, Criteria::IN);



        $rs = UsersPeer::doSelectRs($c);

        $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);



        $rows = Array();

        while ($rs->next()) {

            $rows[] = $rs->getRow();

        }



        if ($PRO_UID != null) {

            //Add supervisor

            // Users

            $oCriteria = new Criteria('workflow');

            $oCriteria->addSelectColumn(ProcessUserPeer::PU_UID);

            $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);

            $oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);

            $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);

            $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);

            $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);

            $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);

            $oCriteria->addJoin(ProcessUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);

            $oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');

            $oCriteria->add(ProcessUserPeer::PRO_UID, $PRO_UID);

            $oCriteria->add(ProcessUserPeer::USR_UID, $USR_UID);

            $oCriteria->addAscendingOrderByColumn(UsersPeer::USR_FIRSTNAME);

            $oDataset = ProcessUserPeer::doSelectRS($oCriteria);

            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

            $flagSupervisors = false;



            if ($oDataset->next()) {

                if (!in_array($USR_UID,$row)) {

                        $rows[] = $oDataset->getRow();

                }

                $flagSupervisors = true;

            }



            if (!$flagSupervisors) {

                // Groups

                $oCriteria = new Criteria('workflow');

                $oCriteria->addSelectColumn(ProcessUserPeer::PU_UID);

                $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);

                $oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);



                $oCriteria->addSelectColumn(UsersPeer::USR_UID);

                $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);

                $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);

                $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);

                $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);



                $oCriteria->addJoin(ProcessUserPeer::USR_UID, GroupUserPeer::GRP_UID, Criteria::LEFT_JOIN);

                $oCriteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);



                $oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');

                $oCriteria->add(ProcessUserPeer::PRO_UID, $PRO_UID);

                $oCriteria->add(GroupUserPeer::USR_UID, $USR_UID);



                $oDataset = ProcessUserPeer::doSelectRS($oCriteria);

                $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);



                if ($oDataset->next()) {

                    if (!in_array($USR_UID,$row)) {

                        $rows[] = $oDataset->getRow();

                    }

                }

            }

        }



        return $rows;

    }
Example #29
0
 function getUserArray($action, $userUid)
 {
     global $oAppCache;
     $status = array();
     $users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER"));
     $users[] = array("ALL", G::LoadTranslation("ID_ALL_USERS"));
     //now get users, just for the Search action
     switch ($action) {
         case 'search_simple':
         case 'search':
             $cUsers = new Criteria('workflow');
             $cUsers->clearSelectColumns();
             $cUsers->addSelectColumn(UsersPeer::USR_UID);
             $cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
             $cUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
             $oDataset = UsersPeer::doSelectRS($cUsers);
             $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataset->next();
             while ($aRow = $oDataset->getRow()) {
                 $users[] = array($aRow['USR_UID'], htmlentities($aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME'], ENT_QUOTES, "UTF-8"));
                 $oDataset->next();
             }
             break;
         default:
             return $users;
             break;
     }
     return $users;
 }
Example #30
0
 function getDenpendentUser($USR_UID)
 {
     //require_once 'classes/model/Users.php';
     //here the uid to next Users
     $oC = new Criteria();
     $oC->addSelectColumn(UsersPeer::USR_REPORTS_TO);
     $oC->add(UsersPeer::USR_UID, $USR_UID);
     $oDataset = UsersPeer::doSelectRS($oC);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     return $aRow['USR_REPORTS_TO'];
 }