本文整理汇总了PHP中G类的典型用法代码示例。如果您正苦于以下问题:PHP G类的具体用法?PHP G怎么用?PHP G使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了G类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Create the application document registry
*
* @param array $aData
* @return string
*
*/
public function create($aData)
{
$oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME);
try {
$sRouteUID = G::generateUniqueID();
$aData['ROU_UID'] = $sRouteUID;
$oRoute = new Route();
// validating default values
$aData['ROU_TO_LAST_USER'] = $this->validateValue(isset($aData['ROU_TO_LAST_USER']) ? $aData['ROU_TO_LAST_USER'] : '', array('TRUE', 'FALSE'), 'FALSE');
$aData['ROU_OPTIONAL'] = $this->validateValue(isset($aData['ROU_OPTIONAL']) ? $aData['ROU_OPTIONAL'] : '', array('TRUE', 'FALSE'), 'FALSE');
$aData['ROU_SEND_EMAIL'] = $this->validateValue(isset($aData['ROU_SEND_EMAIL']) ? $aData['ROU_SEND_EMAIL'] : '', array('TRUE', 'FALSE'), 'TRUE');
$oRoute->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oRoute->validate()) {
$oConnection->begin();
$iResult = $oRoute->save();
$oConnection->commit();
return $sRouteUID;
} else {
$sMessage = '';
$aValidationFailures = $oRoute->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw new Exception('The registry cannot be created!<br />' . $sMessage);
}
} catch (Exception $oError) {
$oConnection->rollback();
throw $oError;
}
}
示例2: iniciarBusqueda
function iniciarBusqueda($numSeccion, $paramStrBuscar)
{
require_once 'clases/Global.php';
$global = new G();
$busqueda = new memestimeBusqueda();
echo '<input type="hidden" name="strLoQueBusco" value="' . $paramStrBuscar . '" />';
$cursor = $busqueda->buscar($paramStrBuscar, $numSeccion, $numResultados, $strRespuesta);
foreach ($cursor as $elemento) {
echo '<div class="col-sm-12 col-md-4 col-lg-4"><div class="thumbnail">';
echo '<img class="img-responsive img-circle" src="http://' . $global->getFtpServer() . '/' . $elemento['url'] . '">';
echo '<div class="caption">';
echo "<h3>" . implode(" ", $elemento['nombreImagen']) . "</h3>";
echo '<p><a href="image.php?image=' . $elemento['_id'] . '" class="btn btn-primary" role="button">Ver</a></p>';
echo '</div></div></div>';
}
$numIndices = ceil($numResultados / 3);
echo '</div>';
echo '<div class="row"><div class="col-md-12 col-lg-12 col-sm-12">';
echo '<input type="hidden" name="numIndices" value= ' . $numIndices . ' />';
echo '<button class="btn btn-default" type="submit" id="btnIrAPrimero" name = "btnIrAPrimero">First</button>';
for ($i = 1; $i <= $numIndices; $i++) {
echo '<button class="btn btn-default" type="submit" id="btnIrA' . $i . '" name = "btnIrA' . $i . '" value = ' . $i . '>' . $i . '</button>';
}
echo '<button class="btn btn-default" type="submit" id="btnIrAUltimo" name = "btnIrAUltimo">Last</button>';
echo '</div></div>';
}
示例3: Log_firebug
/**
* Constructs a new Log_firebug object.
*
* @param string $name Ignored.
* @param string $ident The identity string.
* @param array $conf The configuration array.
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_firebug($name = '', $ident = 'PHP', $conf = array(), $level = PEAR_LOG_DEBUG)
{
if (!class_exists('G')) {
$realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$docuroot = explode('/', $realdocuroot);
array_pop($docuroot);
$pathhome = implode('/', $docuroot) . '/';
array_pop($docuroot);
$pathTrunk = implode('/', $docuroot) . '/';
require_once $pathTrunk . 'gulliver/system/class.g.php';
}
$this->_id = G::encryptOld(microtime());
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);
if (isset($conf['buffering'])) {
$this->_buffering = $conf['buffering'];
}
if ($this->_buffering) {
register_shutdown_function(array(&$this, '_Log_firebug'));
}
if (!empty($conf['lineFormat'])) {
$this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']);
}
if (!empty($conf['timeFormat'])) {
$this->_timeFormat = $conf['timeFormat'];
}
}
示例4: create
/**
* Create the application document registry
* @param array $aData
* @return string
**/
public function create($aData)
{
$oConnection = Propel::getConnection(SwimlanesElementsPeer::DATABASE_NAME);
try {
$aData['SWI_UID'] = G::generateUniqueID();
$oSwimlanesElements = new SwimlanesElements();
$oSwimlanesElements->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oSwimlanesElements->validate()) {
$oConnection->begin();
if (isset($aData['SWI_TEXT'])) {
$oSwimlanesElements->setSwiEleText($aData['SWI_TEXT']);
}
$iResult = $oSwimlanesElements->save();
$oConnection->commit();
return $aData['SWI_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw new Exception('The registry cannot be created!<br />' . $sMessage);
}
} catch (Exception $oError) {
$oConnection->rollback();
throw $oError;
}
}
示例5: create
public function create(array $arrayData)
{
$cnn = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try {
$this->setCfgUid($arrayData["CFG_UID"]);
$this->setObjUid($arrayData["OBJ_UID"]);
$this->setCfgValue(isset($arrayData["CFG_VALUE"]) ? $arrayData["CFG_VALUE"] : "");
$this->setProUid($arrayData["PRO_UID"]);
$this->setUsrUid($arrayData["USR_UID"]);
$this->setAppUid($arrayData["APP_UID"]);
if ($this->validate()) {
$cnn->begin();
$result = $this->save();
$cnn->commit();
//Return
return $result;
} else {
$msg = "";
foreach ($this->getValidationFailures() as $validationFailure) {
$msg = $msg . ($msg != "" ? "\n" : "") . $validationFailure->getMessage();
}
throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . ($msg != "" ? "\n" . $msg : ""));
}
} catch (Exception $e) {
$cnn->rollback();
throw $e;
}
}
示例6: __construct
/**
* __construct
*
* @return void
*/
function __construct()
{
//Initialize the Library and register the Default
$this->registerFunctionsFileToLibrary(PATH_CORE . "classes" . PATH_SEP . "class.pmFunctions.php", "ProcessMaker Functions");
//Register all registered PLugin Functions
if (class_exists('folderData')) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
foreach ($aAvailablePmFunctions as $key => $class) {
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';
if (file_exists($filePlugin) && !is_dir($filePlugin)) {
$this->registerFunctionsFileToLibrary($filePlugin, "ProcessMaker Functions");
}
}
}
//Add External Triggers
$dir = G::ExpandPath("classes") . 'triggers';
$filesArray = array();
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && !is_dir($dir . PATH_SEP . $file)) {
$this->registerFunctionsFileToLibrary($dir . PATH_SEP . $file, "ProcessMaker External Functions");
}
}
closedir($handle);
}
}
}
示例7: create
public function create($aData)
{
$oConnection = Propel::getConnection(StagePeer::DATABASE_NAME);
try {
if (isset($aData['STG_UID']) && $aData['STG_UID'] == '') {
unset($aData['STG_UID']);
}
if (!isset($aData['STG_UID'])) {
$aData['STG_UID'] = G::generateUniqueID();
}
$oStage = new Stage();
$oStage->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$oStage->setStgTitle($aData['STG_TITLE']);
if ($oStage->validate()) {
$oConnection->begin();
$iResult = $oStage->save();
$oConnection->commit();
return $aData['STG_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oStage->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw new Exception('The registry cannot be created!<br />' . $sMessage);
}
} catch (Exception $oError) {
$oConnection->rollback();
throw $oError;
}
}
示例8: getTemporalFields
/**
* this function get the fields that are part of the temporal
* dynaform file.
*
* @name getTemporalFields
* @author gustavo cruz
* @access public
* @param $file - the name of the dynaform file
* @return invalidFields string
*/
function getTemporalFields($file)
{
try {
//$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', 'display:none', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');
$i = 0;
$aFields = array();
$aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char');
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '_tmp0.xml', '', '', '', 'myxml'));
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
$iMaximun = $oDataset->count();
while ($aRow = $oDataset->Read()) {
$aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '', 'row__' => $i + 1);
$i++;
}
// print_r($aFields);
// die;
} catch (Exception $e) {
}
$invalidFields = validateGridConversion($aFields);
if (count($invalidFields) > 0) {
return implode(", ", $invalidFields);
} else {
return "ok";
}
}
示例9: run_create_translation
function run_create_translation($args, $opts)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args);
$rootDir = realpath(__DIR__."/../../../../");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$loadConstants = false;
$workspaces = get_workspaces_from_args($args);
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
$translation = new Translation();
CLI::logging("Updating labels Mafe ...\n");
foreach ($workspaces as $workspace) {
try {
echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n";
$translation->generateTransaltionMafe($lang);
} catch (Exception $e) {
echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
}
}
CLI::logging("Create successful\n");
}
示例10: create
function create($aData)
{
try {
$sCode = $aData['PER_CODE'];
$oCriteria = new Criteria('rbac');
$oCriteria->add(PermissionsPeer::PER_CODE, $sCode);
$oDataset = PermissionsPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if (is_array($aRow)) {
return 1;
}
$aData['PER_UID'] = G::generateUniqueID();
$aData['PER_CODE'] = $aData['PER_CODE'];
$aData['PER_CREATE_DATE'] = date('Y-m-d H:i:s');
$aData['PER_UPDATE_DATE'] = $aData['PER_CREATE_DATE'];
$aData['PER_STATUS'] = 1;
$oPermission = new Permissions();
$oPermission->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$iResult = $oPermission->save();
return $aData['PER_UID'];
} catch (Exception $oError) {
throw $oError;
}
}
示例11: postNote
function postNote($httpData)
{
//extract(getExtJSParams());
$appUid = isset($httpData->appUid) ? $httpData->appUid : '';
$usrUid = isset($httpData->usrUid) ? $httpData->usrUid : '';
require_once "classes/model/AppNotes.php";
$appNotes = new AppNotes();
$noteContent = addslashes($httpData->noteText);
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
//return true;
//die();
//send the response to client
@ini_set('implicit_flush', 1);
ob_start();
//echo G::json_encode($result);
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush(1);
//return true;
//send notification in background
$noteRecipientsList = array();
G::LoadClass('case');
$oCase = new Cases();
$p = $oCase->getUsersParticipatedInCase($appUid);
foreach ($p['array'] as $key => $userParticipated) {
$noteRecipientsList[] = $key;
}
$noteRecipients = implode(",", $noteRecipientsList);
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
}
示例12: minify
public function minify()
{
if ($this->contentType != 'text/css') {
G::LoadThirdParty('jsmin', 'jsmin');
$this->content = JSMin::minify($this->content);
}
}
示例13: AuthenticationBasicHTTP
function AuthenticationBasicHTTP($realm)
{
if (empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER'])) {
header('WWW-Authenticate: Basic realm="' . $realm . '"');
header('HTTP/1.0 401 Unauthorized');
die('401 Unauthorized');
}
global $RBAC;
$uid = $RBAC->VerifyLogin($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if ($uid > 0) {
// Asign the uid of user to userloggedobj
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
$res = $RBAC->userCanAccess('PM_WEBDAV');
if ($res != 1) {
if ($res == -2) {
$msg = G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM');
} else {
$msg = G::LoadTranslation('ID_USER_HAVENT_RIGHTS_PAGE');
}
header('WWW-Authenticate: Basic realm="' . $realm . '"');
header('HTTP/1.0 401 ' . $msg);
die('401 ' . $msg);
return false;
die;
}
return true;
}
header('WWW-Authenticate: Basic realm="' . $realm . '"');
header('HTTP/1.0 401 Unauthorized');
die('401 Unauthorized');
return false;
}
示例14: Presentation
function Presentation(&$base, $what, $typ = 0)
{
global ${"gorum{$what}template"}, $gorumroll;
$this->base =& $base;
if ($typ) {
$this->typ =& $typ;
} else {
$this->typ =& $base->getTypeInfo(TRUE);
}
if (isset($this->typ["{$gorumroll->list}: {$what}Template"])) {
$this->template = $this->typ["{$gorumroll->list}: {$what}Template"];
}
if (isset($this->typ["{$gorumroll->method}: {$what}Template"])) {
$this->template = $this->typ["{$gorumroll->method}: {$what}Template"];
} elseif (isset($this->typ["{$what}Template"])) {
$this->template = $this->typ["{$what}Template"];
} else {
$this->template = ${"gorum{$what}template"};
}
$this->innerBordersOnly = G::getSetting($this->typ, "innerBordersOnly");
if ($this->innerBordersOnly) {
// a szelso td-k kulso bordereit toroljuk:
JavaScript::addOnload("\n \$('.template > table').find('tbody tr:not(.noapply), tfoot tr').find('td:first, th:first').css('border-left', 'none').end().\n find('td:last, th:last').css('border-right', 'none').end().\n find('td.groupsep_v + td').css('border-left', 'none').end().\n find('td.groupsep_v').prev().css('border-right', 'none').end().end().\n slice(-1).find('td').css('border-bottom', 'none');\n ", "innerBordersOnly");
}
}
示例15: renderImagesList
private function renderImagesList()
{
G::addToRender("forms/admin_copy_image_form.php", BLOCK_PRE_CONTENT, CODE);
G::addToRender("admin/mimages_images_table.php", BLOCK_PRE_CONTENT, CODE);
//G::addToRender("forms/admin_product_edit_form.php", BLOCK_CONTENT, CODE);
G::addToRender("forms/admin_upload_image_form.php", BLOCK_CONTENT, CODE);
}