本文整理汇总了PHP中QConvertNotation类的典型用法代码示例。如果您正苦于以下问题:PHP QConvertNotation类的具体用法?PHP QConvertNotation怎么用?PHP QConvertNotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QConvertNotation类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __set
public function __set($strName, $mixValue)
{
// These are included here because this class is constructed before code generation
// include_once(__INCLUDES__ . '/qcodo/_core/codegen/QConvertNotationBase.class.php');
include_once __INCLUDES__ . '/qcodo/codegen/QConvertNotation.class.php';
switch ($strName) {
///////////////////
// Member Variables
///////////////////
default:
try {
$objAdminSetting = AdminSetting::LoadByShortDescription(QConvertNotation::UnderscoreFromCamelCase($strName));
$objAdminSetting->Value = $mixValue;
return $objAdminSetting->Save();
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
示例2: MetaAddTypeColumn
/**
* Similar to MetaAddColumn, except it creates a column for a Type-based Id. You MUST specify
* the name of the Type class that this will attempt to use $NameArray against.
*
* Also, $mixContent cannot be an array. Only a single field can be specified.
*
* @param mixed $mixContent string or QQNode from Country
* @param string $strTypeClassName the name of the TypeClass to use $NameArray against
* @param mixed $objOverrideParameters
*/
public function MetaAddTypeColumn($mixContent, $strTypeClassName, $objOverrideParameters = null)
{
// Validate TypeClassName
if (!class_exists($strTypeClassName) || !property_exists($strTypeClassName, 'NameArray')) {
throw new QCallerException('Invalid TypeClass Name: ' . $strTypeClassName);
}
// Validate Node
try {
$objNode = $this->ResolveContentItem($mixContent);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
// Create the Column
$strName = QConvertNotation::WordsFromCamelCase($objNode->_PropertyName);
if (strtolower(substr($strName, strlen($strName) - 3)) == ' id') {
$strName = substr($strName, 0, strlen($strName) - 3);
}
$strProperty = $objNode->GetDataGridHtml();
$objNewColumn = new QDataGridColumn(QApplication::Translate($strName), sprintf('<?=(%s) ? %s::$NameArray[%s] : null;?>', $strProperty, $strTypeClassName, $strProperty), array('OrderByClause' => QQ::OrderBy($objNode), 'ReverseOrderByClause' => QQ::OrderBy($objNode, false)));
// Perform Overrides
$objOverrideArray = func_get_args();
if (count($objOverrideArray) > 2) {
try {
unset($objOverrideArray[0]);
unset($objOverrideArray[1]);
$objNewColumn->OverrideAttributes($objOverrideArray);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
$this->AddColumn($objNewColumn);
return $objNewColumn;
}
示例3: AnalyzeTable
//.........这里部分代码省略.........
$objReference->IsType = true;
} else {
$objReference->IsType = false;
}
// Setup Table and Column names
$objReference->Table = $strReferencedTableName;
$objReference->Column = $objForeignKey->ReferenceColumnNameArray[0];
// Setup VariableType
$objReference->VariableType = $this->ClassNameFromTableName($strReferencedTableName);
// Setup PropertyName and VariableName
$objReference->PropertyName = $this->ReferencePropertyNameFromColumn($objColumn);
$objReference->VariableName = $this->ReferenceVariableNameFromColumn($objColumn);
// Add this reference to the column
$objColumn->Reference = $objReference;
// STEP 2: Setup the REVERSE Reference for Non Type-based References
if (!$objReference->IsType) {
// Retrieve the ReferencedTable object
// $objReferencedTable = $this->objTableArray[strtolower($objReference->Table)];
$objReferencedTable = $this->GetTable($objReference->Table);
$objReverseReference = new QReverseReference();
$objReverseReference->KeyName = $objReference->KeyName;
$objReverseReference->Table = $strTableName;
$objReverseReference->Column = $strColumnName;
$objReverseReference->NotNull = $objColumn->NotNull;
$objReverseReference->Unique = $objColumn->Unique;
$objReverseReference->PropertyName = $this->PropertyNameFromColumn($this->GetColumn($strTableName, $strColumnName));
$objReverseReference->ObjectDescription = $this->CalculateObjectDescription($strTableName, $strColumnName, $strReferencedTableName, false);
$objReverseReference->ObjectDescriptionPlural = $this->CalculateObjectDescription($strTableName, $strColumnName, $strReferencedTableName, true);
$objReverseReference->VariableName = $this->ReverseReferenceVariableNameFromTable($objTable->Name);
$objReverseReference->VariableType = $this->ReverseReferenceVariableTypeFromTable($objTable->Name);
// For Special Case ReverseReferences, calculate Associated MemberVariableName and PropertyName...
// See if ReverseReference is due to an ORM-based Class Inheritence Chain
if (count($objTable->PrimaryKeyColumnArray) == 1 && $objColumn->PrimaryKey) {
$objReverseReference->ObjectMemberVariable = QConvertNotation::PrefixFromType(QType::Object) . $objReverseReference->VariableType;
$objReverseReference->ObjectPropertyName = $objReverseReference->VariableType;
$objReverseReference->ObjectDescription = $objReverseReference->VariableType;
$objReverseReference->ObjectDescriptionPlural = $this->Pluralize($objReverseReference->VariableType);
// Otherwise, see if it's just plain ol' unique
} else {
if ($objColumn->Unique) {
$objReverseReference->ObjectMemberVariable = $this->CalculateObjectMemberVariable($strTableName, $strColumnName, $strReferencedTableName);
$objReverseReference->ObjectPropertyName = $this->CalculateObjectPropertyName($strTableName, $strColumnName, $strReferencedTableName);
}
}
// Add this ReverseReference to the referenced table's ReverseReferenceArray
$objArray = $objReferencedTable->ReverseReferenceArray;
array_push($objArray, $objReverseReference);
$objReferencedTable->ReverseReferenceArray = $objArray;
}
} else {
$this->strErrors .= sprintf("Foreign Key %s in table %s references a table %s that does not appear to exist.\n", $objForeignKey->KeyName, $strTableName, $objForeignKey->ReferenceTableName);
}
} else {
$this->strErrors .= sprintf("Foreign Key %s in table %s indexes on a column that does not appear to exist.\n", $objForeignKey->KeyName, $strTableName);
}
}
}
}
// Verify: Table Name is valid (alphanumeric + "_" characters only, must not start with a number)
// and NOT a PHP Reserved Word
$strMatches = array();
preg_match('/' . $this->strPatternTableName . '/', $strTableName, $strMatches);
if (count($strMatches) && $strMatches[0] == $strTableName && $strTableName != '_') {
// Setup Reserved Words
$strReservedWords = explode(',', QCodeGen::PhpReservedWords);
for ($intIndex = 0; $intIndex < count($strReservedWords); $intIndex++) {
示例4: CalculateObjectDescriptionForAssociation
protected function CalculateObjectDescriptionForAssociation($strAssociationTableName, $strTableName, $strReferencedTableName, $blnPluralize)
{
// Strip Prefixes (if applicable)
$strTableName = $this->StripPrefixFromTable($strTableName);
$strAssociationTableName = $this->StripPrefixFromTable($strAssociationTableName);
$strReferencedTableName = $this->StripPrefixFromTable($strReferencedTableName);
// Starting Point
$strToReturn = QConvertNotation::CamelCaseFromUnderscore($strReferencedTableName);
if ($blnPluralize) {
$strToReturn = $this->Pluralize($strToReturn);
}
// Let's start with strAssociationTableName
// Rip out trailing "_assn" if applicable
$strAssociationTableName = str_replace($this->strAssociationTableSuffix, '', $strAssociationTableName);
// Take out strTableName if applicable (both with and without underscores)
$strAssociationTableName = str_replace($strTableName, '', $strAssociationTableName);
$strTableName = str_replace('_', '', $strTableName);
$strAssociationTableName = str_replace($strTableName, '', $strAssociationTableName);
// Take out strReferencedTableName if applicable (both with and without underscores)
$strAssociationTableName = str_replace($strReferencedTableName, '', $strAssociationTableName);
$strReferencedTableName = str_replace('_', '', $strReferencedTableName);
$strAssociationTableName = str_replace($strReferencedTableName, '', $strAssociationTableName);
// Change any double "__" to single "_"
$strAssociationTableName = str_replace("__", "_", $strAssociationTableName);
$strAssociationTableName = str_replace("__", "_", $strAssociationTableName);
$strAssociationTableName = str_replace("__", "_", $strAssociationTableName);
// If we have nothing left or just a single "_" in AssociationTableName, return "Starting Point"
if ($strAssociationTableName == "_" || $strAssociationTableName == "") {
return sprintf("%s%s%s", $this->strAssociatedObjectPrefix, $strToReturn, $this->strAssociatedObjectSuffix);
}
// Otherwise, add "As" and the predicate
return sprintf("%s%sAs%s%s", $this->strAssociatedObjectPrefix, $strToReturn, QConvertNotation::CamelCaseFromUnderscore($strAssociationTableName), $this->strAssociatedObjectSuffix);
}
示例5: btnDelete_Click
}
protected function btnDelete_Click($strFormId, $strControlId, $strParameter) {
// Delegate "Delete" processing to the <?php
echo $objTable->ClassName;
?>
MetaControl
$this->mct<?php
echo $objTable->ClassName;
?>
->Delete<?php
echo $objTable->ClassName;
?>
();
$this->RedirectToListPage();
}
protected function btnCancel_Click($strFormId, $strControlId, $strParameter) {
$this->RedirectToListPage();
}
// Other Methods
protected function RedirectToListPage() {
QApplication::Redirect(__VIRTUAL_DIRECTORY__ . __FORM_DRAFTS__ . '/<?php
echo QConvertNotation::UnderscoreFromCamelCase($objTable->ClassName);
?>
_list.php');
}
}
?>
示例6: JavaCaseFromUnderscore
public static function JavaCaseFromUnderscore($strName)
{
$strToReturn = QConvertNotation::CamelCaseFromUnderscore($strName);
return strtolower(substr($strToReturn, 0, 1)) . substr($strToReturn, 1);
}
示例7: _Create
* @param string $strControlId optional ControlId to use
* @return QLabel
*/
public function <?php
echo $strLabelId;
?>
_Create($strControlId = null) {
$this-><?php
echo $strLabelId;
?>
= new QLabel($this->objParentObject, $strControlId);
$this-><?php
echo $strLabelId;
?>
->Name = QApplication::Translate('<?php
echo QConvertNotation::WordsFromCamelCase($objReverseReference->ObjectPropertyName);
?>
');
$this-><?php
echo $strLabelId;
?>
->Text = ($this-><?php
echo $strObjectName;
?>
-><?php
echo $objReverseReference->ObjectPropertyName;
?>
) ? $this-><?php
echo $strObjectName;
?>
-><?php
示例8: _Create
* @param string $strControlId optional ControlId to use
* @return QLabel
*/
public function <?php
echo $strLabelId;
?>
_Create($strControlId = null) {
$this-><?php
echo $strLabelId;
?>
= new QLabel($this->objParentObject, $strControlId);
$this-><?php
echo $strLabelId;
?>
->Name = QApplication::Translate('<?php
echo QConvertNotation::WordsFromCamelCase($objManyToManyReference->ObjectDescriptionPlural);
?>
');
$aSelection = $this-><?php
echo $strObjectName;
?>
->Get<?php
echo $objManyToManyReference->ObjectDescription;
?>
Array();
$this-><?php
echo $strLabelId;
?>
->Text = implode($this->str<?php
echo $objManyToManyReference->ObjectDescription;
示例9: CalculateObjectDescriptionForAssociation
protected function CalculateObjectDescriptionForAssociation($strAssociationTableName, $strTableName, $strReferencedTableName, $blnPluralize)
{
// Strip Prefixes (if applicable)
$strTableName = $this->StripPrefixFromTable($strTableName);
$strAssociationTableName = $this->StripPrefixFromTable($strAssociationTableName);
$strReferencedTableName = $this->StripPrefixFromTable($strReferencedTableName);
// Starting Point
$strToReturn = QConvertNotation::CamelCaseFromUnderscore($strReferencedTableName);
if ($blnPluralize) {
$strToReturn = $this->Pluralize($strToReturn);
}
// Let's start with strAssociationTableName
// Rip out trailing "_assn" if applicable
$strAssociationTableName = str_replace($this->strAssociationTableSuffix, '', $strAssociationTableName);
// remove instances of the table names in the association table name
$strTableName2 = str_replace('_', '', $strTableName);
// remove underscores if they are there
$strReferencedTableName2 = str_replace('_', '', $strReferencedTableName);
// remove underscores if they are there
if (beginsWith($strAssociationTableName, $strTableName . '_')) {
$strAssociationTableName = trimOffFront($strTableName . '_', $strAssociationTableName);
} elseif (beginsWith($strAssociationTableName, $strTableName2 . '_')) {
$strAssociationTableName = trimOffFront($strTableName2 . '_', $strAssociationTableName);
} elseif (beginsWith($strAssociationTableName, $strReferencedTableName . '_')) {
$strAssociationTableName = trimOffFront($strReferencedTableName . '_', $strAssociationTableName);
} elseif (beginsWith($strAssociationTableName, $strReferencedTableName2 . '_')) {
$strAssociationTableName = trimOffFront($strReferencedTableName2 . '_', $strAssociationTableName);
} elseif ($strAssociationTableName == $strTableName || $strAssociationTableName == $strTableName2 || $strAssociationTableName == $strReferencedTableName || $strAssociationTableName == $strReferencedTableName2) {
$strAssociationTableName = "";
}
if (endsWith($strAssociationTableName, '_' . $strTableName)) {
$strAssociationTableName = trimOffEnd('_' . $strTableName, $strAssociationTableName);
} elseif (endsWith($strAssociationTableName, '_' . $strTableName2)) {
$strAssociationTableName = trimOffEnd('_' . $strTableName2, $strAssociationTableName);
} elseif (endsWith($strAssociationTableName, '_' . $strReferencedTableName)) {
$strAssociationTableName = trimOffEnd('_' . $strReferencedTableName, $strAssociationTableName);
} elseif (endsWith($strAssociationTableName, '_' . $strReferencedTableName2)) {
$strAssociationTableName = trimOffEnd('_' . $strReferencedTableName2, $strAssociationTableName);
} elseif ($strAssociationTableName == $strTableName || $strAssociationTableName == $strTableName2 || $strAssociationTableName == $strReferencedTableName || $strAssociationTableName == $strReferencedTableName2) {
$strAssociationTableName = "";
}
// Change any double "__" to single "_"
$strAssociationTableName = str_replace("__", "_", $strAssociationTableName);
$strAssociationTableName = str_replace("__", "_", $strAssociationTableName);
$strAssociationTableName = str_replace("__", "_", $strAssociationTableName);
// If we have nothing left or just a single "_" in AssociationTableName, return "Starting Point"
if ($strAssociationTableName == "_" || $strAssociationTableName == "") {
return sprintf("%s%s%s", $this->strAssociatedObjectPrefix, $strToReturn, $this->strAssociatedObjectSuffix);
}
// Otherwise, add "As" and the predicate
return sprintf("%s%sAs%s%s", $this->strAssociatedObjectPrefix, $strToReturn, QConvertNotation::CamelCaseFromUnderscore($strAssociationTableName), $this->strAssociatedObjectSuffix);
}
示例10:
}
// protected function Form_Load() {}
<?php
include 'edit_form_create.tpl.php';
?>
<?php
include 'edit_create_buttons.tpl.php';
?>
<?php
include 'edit_button_click.tpl.php';
?>
}
// Go ahead and run this form object to render the page and its event handlers, implicitly using
// <?php
echo QConvertNotation::UnderscoreFromCamelCase($strPropertyName);
?>
_edit.tpl.php as the included HTML template file
<?php
echo $strPropertyName;
?>
EditForm::Run('<?php
echo $strPropertyName;
?>
EditForm');
示例11: _Create
* @param string $strControlId optional ControlId to use
* @return QLabel
*/
public function <?php
echo $strLabelId;
?>
_Create($strControlId = null) {
$this-><?php
echo $strLabelId;
?>
= new QLabel($this->objParentObject, $strControlId);
$this-><?php
echo $strLabelId;
?>
->Name = QApplication::Translate('<?php
echo QConvertNotation::WordsFromCamelCase($objColumn->Reference->PropertyName);
?>
');
$this-><?php
echo $strLabelId;
?>
->Text = ($this-><?php
echo $strObjectName;
?>
-><?php
echo $objColumn->Reference->PropertyName;
?>
) ? $this-><?php
echo $strObjectName;
?>
-><?php