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


PHP G::generateCode方法代码示例

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


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

示例1: create

 public function create($arrayData)
 {
     $cnn = Propel::getConnection(OauthClientsPeer::DATABASE_NAME);
     try {
         $cnn->begin();
         $id = G::generateCode(32, "ALPHA");
         $secret = G::generateUniqueID();
         $this->setClientId($id);
         $this->setClientSecret($secret);
         $this->setClientName($arrayData["CLIENT_NAME"]);
         $this->setClientDescription($arrayData["CLIENT_DESCRIPTION"]);
         $this->setClientWebsite($arrayData["CLIENT_WEBSITE"]);
         $this->setRedirectUri($arrayData["REDIRECT_URI"]);
         $this->setUsrUid($arrayData["USR_UID"]);
         if ($this->validate()) {
             $result = $this->save();
             $cnn->commit();
             return array("CLIENT_ID" => $id, "CLIENT_SECRET" => $secret);
         } else {
             $cnn->rollback();
             throw new Exception("Failed Validation in class \"" . get_class($this) . "\".");
         }
     } catch (Exception $e) {
         $cnn->rollback();
         throw $e;
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:27,代码来源:OauthClients.php

示例2: testGenerateCode

 /**
  * @covers G::generateCode
  * @todo   Implement testGenerateCode().
  */
 public function testGenerateCode()
 {
     $uid = G::generateCode();
     $this->assertTrue(is_numeric($uid) && strlen($uid) == 4);
     $uid = G::generateCode(10);
     $this->assertTrue(is_numeric($uid) && strlen($uid) == 10);
     $uid = G::generateCode('ALPHA');
     $this->assertTrue(is_string($uid) && strlen($uid) == 4);
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:13,代码来源:GTest.php

示例3: switch

<?php

switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        $G_PUBLISH = new Publisher();
        $tpl = array_key_exists('l', $_GET) ? 'oauth2/registration_done' : 'oauth2/register';
        $G_PUBLISH->AddContent('view', $tpl);
        G::RenderPage('publish', 'minimal');
        break;
    case 'POST':
        $data = $_POST['form'];
        $clientId = G::generateCode(32, 'ALPHA');
        $secret = G::generateUniqueID();
        $client = new OauthClients();
        $client->setClientId($clientId);
        $client->setClientSecret($secret);
        $client->setClientName($data['name']);
        $client->setClientDescription($data['description']);
        $client->setClientWebsite($data['web_site']);
        $client->setRedirectUri($data['callback_url']);
        $client->setUsrUid($_SESSION['USER_LOGGED']);
        $client->save();
        $data['clientId'] = $clientId;
        $data['secret'] = $secret;
        header('location: register?l=' . base64_encode(json_encode($data)));
        break;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:27,代码来源:register.php

示例4: generateCode

/**
 *
 * @method
 *
 * Creates a random string of letters and/or numbers of a specified length,which
 * can be used as the PINs (public identification numbers) and codes for cases.
 *
 * @name generateCode
 * @label generate Code
 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#generateCode.28.29
 *
 * @param int | $iDigits = 4 | Number of characters | The number of characters to be generated.
 * @param string(32) | $sType="NUMERIC" | Type of characters | The type of of characters to be generated
 * @return string | $generateString | Generated string | The generated string of random characters.
 *
 */
function generateCode($iDigits = 4, $sType = 'NUMERIC')
{
    return G::generateCode($iDigits, $sType);
}
开发者ID:ralpheav,项目名称:processmaker,代码行数:20,代码来源:class.pmFunctions.php

示例5: create

 /**
  * Creates the Application
  *
  * @param
  *   $sProUid the process id
  *   $sUsrUid the userid
  * @return     void
  */
 public function create($sProUid, $sUsrUid)
 {
     require_once "classes/model/Sequences.php";
     $con = Propel::getConnection('workflow');
     try {
         //fill the default values for new application row
         $this->setAppUid(G::generateUniqueID());
         $this->setAppParent('');
         $this->setAppStatus('DRAFT');
         $this->setProUid($sProUid);
         $this->setAppProcStatus('');
         $this->setAppProcCode('');
         $this->setAppParallel('N');
         $this->setAppInitUser($sUsrUid);
         $this->setAppCurUser($sUsrUid);
         $this->setAppCreateDate('now');
         $this->setAppInitDate('now');
         $this->setAppUpdateDate('now');
         $pin = G::generateCode(4, 'ALPHANUMERIC');
         $this->setAppData(serialize(array('PIN' => $pin)));
         $this->setAppPin(md5($pin));
         $c = new Criteria();
         $c->clearSelectColumns();
         $oSequences = new Sequences();
         $oSequences->lockSequenceTable();
         $maxNumber = $oSequences->getSequeceNumber("APP_NUMBER");
         $this->setAppNumber($maxNumber);
         $oSequences->changeSequence('APP_NUMBER', $maxNumber);
         $oSequences->unlockSequenceTable();
         if ($this->validate()) {
             $con->begin();
             $res = $this->save();
             $con->commit();
             //to do: ID_CASE in translation $this->setAppTitle(G::LoadTranslation('ID_CASE') . $maxNumber);
             $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
             Content::insertContent('APP_TITLE', '', $this->getAppUid(), $lang, '#' . $maxNumber);
             Content::insertContent('APP_DESCRIPTION', '', $this->getAppUid(), $lang, '');
             //Content::insertContent('APP_PROC_CODE', '', $this->getAppUid(), $lang, '');
             $con->commit();
             return $this->getAppUid();
         } else {
             $msg = '';
             foreach ($this->getValidationFailures() as $objValidationFailure) {
                 $msg .= $objValidationFailure->getMessage() . "<br/>";
             }
             throw new PropelException('The APPLICATION row cannot be created!', new PropelException($msg));
         }
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:60,代码来源:Application.php

示例6: create

 /**
  * Creates the Application
  *
  * @param
  *   $sProUid the process id
  *   $sUsrUid the userid
  * @return     void
  */
 public function create($sProUid, $sUsrUid)
 {
     $con = Propel::getConnection('workflow');
     try {
         //fill the default values for new application row
         $this->setAppUid(G::generateUniqueID());
         $this->setAppParent('');
         $this->setAppStatus('DRAFT');
         $this->setProUid($sProUid);
         $this->setAppProcStatus('');
         $this->setAppProcCode('');
         $this->setAppParallel('N');
         $this->setAppInitUser($sUsrUid);
         $this->setAppCurUser($sUsrUid);
         $this->setAppCreateDate('now');
         $this->setAppInitDate('now');
         $this->setAppUpdateDate('now');
         $pin = G::generateCode(4, 'ALPHANUMERIC');
         $this->setAppData(serialize(array('PIN' => $pin)));
         $this->setAppPin(md5($pin));
         $c = new Criteria();
         $c->clearSelectColumns();
         $c->addSelectColumn('MAX(' . ApplicationPeer::APP_NUMBER . ')');
         //the appnumber is based in all processes
         //active, not only in the specified
         //process guid
         $result = ApplicationPeer::doSelectRS($c);
         $result->next();
         $row = $result->getRow();
         $maxNumber = $row[0] + 1;
         $this->setAppNumber($maxNumber);
         if ($this->validate()) {
             $con->begin();
             $res = $this->save();
             $con->commit();
             //to do: ID_CASE in translation $this->setAppTitle(G::LoadTranslation('ID_CASE') . $maxNumber);
             $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
             Content::insertContent('APP_TITLE', '', $this->getAppUid(), $lang, '#' . $maxNumber);
             Content::insertContent('APP_DESCRIPTION', '', $this->getAppUid(), $lang, '');
             //Content::insertContent('APP_PROC_CODE', '', $this->getAppUid(), $lang, '');
             $con->commit();
             return $this->getAppUid();
         } else {
             $msg = '';
             foreach ($this->getValidationFailures() as $objValidationFailure) {
                 $msg .= $objValidationFailure->getMessage() . "<br/>";
             }
             throw new PropelException('The APPLICATION row cannot be created!', new PropelException($msg));
         }
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:nshong,项目名称:processmaker,代码行数:62,代码来源:Application.php


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