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


PHP CustomField类代码示例

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


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

示例1: saveCustomField

 /**
  * Save CustomField
  * @param CustomField $customField
  * @returns CustomField
  * @throws DaoException, DataDuplicationException
  */
 public function saveCustomField(CustomField $customField)
 {
     try {
         $q = Doctrine_Query::create()->from('CustomField c')->where('c.name = ?', $customField->name)->andWhere('c.id <> ?', $customField->id);
         $freeNum = null;
         if (empty($customField->id)) {
             $q = Doctrine_Query::create()->select('c.field_num')->from('CustomField c')->orderBy('id');
             $fieldNumbers = $q->execute(array(), Doctrine::HYDRATE_SCALAR);
             $count = count($fieldNumbers);
             $i = 1;
             foreach ($fieldNumbers as $num) {
                 if ($num['c_id'] > $i) {
                     $freeNum = $i;
                     break;
                 }
                 $i++;
                 if ($i > 10) {
                     break;
                 }
             }
             if (empty($freeNum) && $i <= 10) {
                 $freeNum = $i;
             }
             $customField->id = $freeNum;
         }
         if (!empty($customField->id)) {
             $customField->save();
         }
         return $customField;
         // @codeCoverageIgnoreStart
     } catch (Exception $e) {
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
     // @codeCoverageIgnoreEnd
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:41,代码来源:CustomFieldConfigurationDao.php

示例2: testSaveCustomField

 public function testSaveCustomField()
 {
     $customField = new CustomField();
     $customField->setName('Hobby');
     $customField->setType(0);
     $customField->setScreen('personal');
     $result = $this->customFieldConfigurationDao->saveCustomField($customField);
     $this->assertTrue($result instanceof CustomField);
     $this->assertEquals('Hobby', $result->getName());
     $this->assertEquals(6, $result->getId());
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:11,代码来源:CustomFieldConfigurationDaoTest.php

示例3: getFieldinput

 public function getFieldinput($custom_field_id)
 {
     $campoextra = CustomField::find($custom_field_id);
     $customfield = $campoextra->getCustomFieldInstance();
     $data['customfield'] = $customfield;
     return View::make('backend/customfields/inputs/' . $campoextra->type, $data);
 }
开发者ID:e-gob,项目名称:api-instituciones-v2,代码行数:7,代码来源:CamposExtraController.php

示例4: addField

 protected function addField($row)
 {
     $field = CustomField::constructObject($row);
     if ($field != null) {
         $this->fields[$row['position']][$field->getFieldName()] = $field;
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:7,代码来源:class.cache_fields.php

示例5: __construct

 public function __construct($objParentObject, $strControlId = null, $blnShowCheckboxes = false)
 {
     // First, call the parent to do most of the basic setup
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->objParentObject = $objParentObject;
     $this->dtgLocation = new QDataGrid($this);
     $this->dtgLocation->Name = 'location_list';
     $this->dtgLocation->CellPadding = 5;
     $this->dtgLocation->CellSpacing = 0;
     $this->dtgLocation->CssClass = "datagrid";
     // Disable AJAX for the datagrid
     $this->dtgLocation->UseAjax = false;
     // Allow for column toggling
     $this->dtgLocation->ShowColumnToggle = true;
     // Allow for CSV Export
     $this->dtgLocation->ShowExportCsv = true;
     // Enable Pagination, and set to 20 items per page
     $objPaginator = new QPaginator($this->dtgLocation);
     $this->dtgLocation->Paginator = $objPaginator;
     $this->dtgLocation->ItemsPerPage = 20;
     // If the user wants the checkboxes column
     if ($blnShowCheckboxes) {
         // This will render all of the necessary controls and actions. chkSelected_Render expects a unique ID for each row of the database.
         $this->dtgLocation->AddColumn(new QDataGridColumnExt('<?=$_CONTROL->chkSelectAll_Render() ?>', '<?=$_CONTROL->chkSelected_Render($_ITEM->LocationId) ?>', 'CssClass="dtg_column"', 'HtmlEntities=false'));
     }
     $this->dtgLocation->AddColumn(new QDataGridColumnExt('Location', '<?= $_ITEM->__toStringWithLink("bluelink") ?>', array('OrderByClause' => QQ::OrderBy(QQN::Location()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Location()->ShortDescription, false)), 'CssClass="dtg_column"', 'HtmlEntities=false'));
     $this->dtgLocation->AddColumn(new QDataGridColumnExt('Description', '<?= $_ITEM->LongDescription ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Location()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Location()->LongDescription, false)), 'CssClass="dtg_column"'));
     $this->dtgLocation->AddColumn(new QDataGridColumnExt('Created By', '<?= $_ITEM->CreatedByObject->__toStringFullName() ?>', array('OrderByClause' => QQ::OrderBy(QQN::Location()->CreatedByObject->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Location()->CreatedByObject->LastName, false)), 'CssClass="dtg_column"'));
     // Add the custom field columns with Display set to false. These can be shown by using the column toggle menu.
     $objCustomFieldArray = CustomField::LoadObjCustomFieldArray(2, false);
     if ($objCustomFieldArray) {
         foreach ($objCustomFieldArray as $objCustomField) {
             //Only add the custom field column if the role has authorization to view it.
             if ($objCustomField->objRoleAuthView && $objCustomField->objRoleAuthView->AuthorizedFlag) {
                 $this->dtgLocation->AddColumn(new QDataGridColumnExt($objCustomField->ShortDescription, '<?= $_ITEM->GetVirtualAttribute(\'' . $objCustomField->CustomFieldId . '\') ?>', 'SortByCommand="__' . $objCustomField->CustomFieldId . ' ASC"', 'ReverseSortByCommand="__' . $objCustomField->CustomFieldId . ' DESC"', 'HtmlEntities="false"', 'CssClass="dtg_column"', 'Display="false"'));
             }
         }
     }
     $this->dtgLocation->SortColumnIndex = 1;
     $this->dtgLocation->SortDirection = 0;
     $objStyle = $this->dtgLocation->RowStyle;
     $objStyle->ForeColor = '#000000';
     $objStyle->BackColor = '#FFFFFF';
     $objStyle->FontSize = 12;
     $objStyle = $this->dtgLocation->AlternateRowStyle;
     $objStyle->BackColor = '#EFEFEF';
     $objStyle = $this->dtgLocation->HeaderRowStyle;
     $objStyle->ForeColor = '#000000';
     $objStyle->BackColor = '#EFEFEF';
     $objStyle->CssClass = 'dtg_header';
     $this->dtgLocation->SetDataBinder('dtgLocation_Bind', $this);
     $this->txtLocation_Create();
     $this->btnSearch_Create();
     $this->btnClear_Create();
 }
开发者ID:brustj,项目名称:tracmor,代码行数:60,代码来源:QLocationSearchComposite.class.php

示例6: execute

 /**
  * Delete custom fields
  * @param $request
  * @return unknown_type
  */
 public function execute($request)
 {
     $admin = $this->getUser()->hasCredential(Auth::ADMIN_ROLE);
     if (!$admin) {
         $this->forward("auth", "unauthorized");
         return;
     }
     $form = new CustomFieldForm(array(), array(), true);
     $customFieldsService = $this->getCustomFieldService();
     if ($request->isMethod('post')) {
         $form->bind($request->getParameter($form->getName()));
         if ($form->isValid()) {
             $fieldNum = $form->getValue('field_num');
             $customField = null;
             if (isset($fieldNum)) {
                 $customField = $customFieldsService->getCustomField($fieldNum);
             }
             if (empty($customField)) {
                 $customField = new CustomField();
             }
             $customField->setName($form->getValue('name'));
             $customField->setType($form->getValue('type'));
             $customField->setScreen($form->getValue('screen'));
             $customField->setExtraData($form->getValue('extra_data'));
             $customFieldsService->saveCustomField($customField);
             $this->getUser()->setFlash('templateMessage', array('success', __(TopLevelMessages::SAVE_SUCCESS)));
         }
     }
     $this->redirect('pim/listCustomFields');
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:35,代码来源:defineCustomFieldAction.class.php

示例7: __construct

 public function __construct($objParentObject, $intEntityQtypeId = null, $strControlId = null)
 {
     // First, call the parent to do most of the basic setup
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->objParentObject = $objParentObject;
     $this->intEntityQtypeId = $intEntityQtypeId;
     $this->chkEntityView = new QCheckBox($this);
     $this->chkEntityEdit = new QCheckBox($this);
     $this->chkBuiltInView = new QCheckBox($this);
     $this->chkBuiltInView->Enabled = false;
     $this->chkBuiltInView->Checked = true;
     $intRoleId = QApplication::QueryString('intRoleId');
     if ($intRoleId) {
         $objBuiltInViewAuth = RoleEntityQtypeBuiltInAuthorization::LoadByRoleIdEntityQtypeIdAuthorizationId($intRoleId, $intEntityQtypeId, 1);
     }
     if (isset($objBuiltInViewAuth)) {
         $this->chkBuiltInView->Checked = $objBuiltInViewAuth->AuthorizedFlag;
     }
     $this->chkBuiltInEdit = new QCheckBox($this);
     if ($intRoleId) {
         $objBuiltInEditAuth = RoleEntityQtypeBuiltInAuthorization::LoadByRoleIdEntityQtypeIdAuthorizationId($intRoleId, $intEntityQtypeId, 2);
     }
     if (isset($objBuiltInEditAuth)) {
         $this->chkBuiltInEdit->Checked = $objBuiltInEditAuth->AuthorizedFlag;
     }
     // Load all custom fields and their values into an array arrCustomChecks
     $objCustomFieldArray = CustomField::LoadObjCustomFieldArray($intEntityQtypeId, false, null);
     foreach ($objCustomFieldArray as $objCustomField) {
         $chkCustomView = new QCheckBox($this);
         $chkCustomEdit = new QCheckBox($this);
         $objEntityQtypeCustomField = EntityQtypeCustomField::LoadByEntityQtypeIdCustomFieldId($intEntityQtypeId, $objCustomField->CustomFieldId);
         if ($objEntityQtypeCustomField) {
             $objCustomAuthView = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId($intRoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 1);
             if ($objCustomAuthView) {
                 $chkCustomView->Checked = $objCustomAuthView->AuthorizedFlag;
             }
             $objCustomAuthEdit = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId($intRoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 2);
             if ($objCustomAuthEdit) {
                 $chkCustomEdit->Checked = $objCustomAuthEdit->AuthorizedFlag;
             }
         }
         $this->arrCustomChecks[] = array('name' => $objCustomField->ShortDescription . ':', 'view' => $chkCustomView, 'edit' => $chkCustomEdit);
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:49,代码来源:QFieldLevelAuthComposite.php

示例8: suggest

 public function suggest()
 {
     $data = array();
     $id = Request::get(1, VAR_INT);
     $q = Request::get('q');
     $q = SystemEnvironment::fromUtf8($q);
     $db = Database::getObject();
     $db->query("SELECT * FROM <p>fields WHERE id = <id:int>", compact("id"));
     if ($db->numRows() == 1) {
         $field = CustomField::constructObject($db->fetchAssoc());
         if ($field instanceof CustomAutoCompleteTextField) {
             $data = $field->getList($q);
         }
     }
     Response::getObject()->sendHeader('Content-Type: text/plain; charset=' . Config::get('intl.charset'));
     echo implode("\n", $data);
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:17,代码来源:class.BackendPages.php

示例9: updateValueByDataIdAndOldValueAndNewValue

 public static function updateValueByDataIdAndOldValueAndNewValue($customFieldDataId, $oldValue, $newValue)
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     $customFieldTableName = CustomField::getTableName();
     $baseCustomFieldTableName = BaseCustomField::getTableName();
     $baseCustomFieldJoinColumnName = $baseCustomFieldTableName . '_id';
     $valueAttributeColumnName = 'value';
     $dataAttributeColumnName = static::getForeignKeyName('BaseCustomField', 'data');
     $sql = "update {$quote}{$customFieldTableName}{$quote}, {$quote}{$baseCustomFieldTableName}{$quote} ";
     $sql .= "set {$quote}{$valueAttributeColumnName}{$quote} = '{$newValue}' ";
     $sql .= "where {$quote}{$customFieldTableName}{$quote}.{$baseCustomFieldJoinColumnName} = ";
     // Not Coding Standard
     $sql .= "{$quote}{$baseCustomFieldTableName}{$quote}.id ";
     $sql .= "AND {$quote}{$dataAttributeColumnName}{$quote} = {$customFieldDataId} ";
     $sql .= "AND {$quote}{$valueAttributeColumnName}{$quote} = '{$oldValue}'";
     ZurmoRedBean::exec($sql);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:17,代码来源:CustomField.php

示例10: withJSON

 /**
  * Create a new instance and populate its properties with JSON data
  * @param array $jsonData
  * @return \moosend\Models\Subscriber
  */
 public static function withJSON(array $jsonData)
 {
     $instance = new self();
     $instance->ID = $jsonData['ID'];
     $instance->Name = $jsonData['Name'];
     $instance->Email = $jsonData['Email'];
     $instance->CreatedOn = $jsonData['CreatedOn'];
     $instance->UpdatedOn = $jsonData['UpdatedOn'];
     $instance->UnsubscribedOn = $jsonData['UnsubscribedOn'];
     $instance->UnsubscribedFromID = $jsonData['UnsubscribedFromID'];
     $instance->SubscribeType = $jsonData['SubscribeType'];
     $instance->CustomFields = array();
     foreach ($jsonData['CustomFields'] as $field) {
         $customField = CustomField::withJSON($field);
         array_push($instance->CustomFields, $customField);
     }
     return $instance;
 }
开发者ID:moosend,项目名称:phpwrapper,代码行数:23,代码来源:Subscriber.php

示例11: SetupCustomField

 protected function SetupCustomField()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intCustomFieldId = QApplication::QueryString('intCustomFieldId');
     if ($intCustomFieldId) {
         $this->objCustomField = CustomField::Load($intCustomFieldId);
         if (!$this->objCustomField) {
             throw new Exception('Could not find a CustomField object with PK arguments: ' . $intCustomFieldId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objCustomField = new CustomField();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:18,代码来源:CustomFieldEditFormBase.class.php

示例12: LoadAllWithCustomFields

    public static function LoadAllWithCustomFields($strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        Manufacturer::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup QueryExpansion
        $objQueryExpansion = new QQueryExpansion();
        if ($objExpansionMap) {
            try {
                Manufacturer::ExpandQuery('manufacturer', null, $objExpansionMap, $objQueryExpansion);
            } catch (QCallerException $objExc) {
                $objExc->IncrementOffset();
                throw $objExc;
            }
        }
        $arrCustomFieldSql = CustomField::GenerateSql(5);
        $strQuery = sprintf('
				SELECT
					%s
					`manufacturer`.`manufacturer_id` AS `manufacturer_id`,
					`manufacturer`.`short_description` AS `short_description`,
					`manufacturer`.`long_description` AS `long_description`,
					`manufacturer`.`image_path` AS `image_path`,
					`manufacturer`.`created_by` AS `created_by`,
					`manufacturer`.`creation_date` AS `creation_date`,
					`manufacturer`.`modified_by` AS `modified_by`,
					`manufacturer`.`modified_date` AS `modified_date`
					%s
					%s
				FROM
					`manufacturer` AS `manufacturer`
					%s
					%s
				WHERE
				1=1
				%s
				%s
			', $strLimitPrefix, $objQueryExpansion->GetSelectSql(",\n\t\t\t\t\t", ",\n\t\t\t\t\t"), $arrCustomFieldSql['strSelect'], $objQueryExpansion->GetFromSql("", "\n\t\t\t\t\t"), $arrCustomFieldSql['strFrom'], $strOrderBy, $strLimitSuffix);
        //echo($strQuery); exit;
        $objDbResult = $objDatabase->Query($strQuery);
        return Manufacturer::InstantiateDbResult($objDbResult);
    }
开发者ID:heshuai64,项目名称:einv2,代码行数:40,代码来源:Manufacturer.class.php

示例13: testValidation

 public function testValidation()
 {
     $f = new CustomField();
     $f->name = 'Id';
     $f->format = 'IP';
     $f->element = "text";
     /*$this->assertDoesntThrow(function () {
         $f->save();
       });*/
     $this->assertFalse(CustomField::saving($f));
     //horrible hacky workaround to even problems
     //for Laravel testing. Blech.
     $g = new CustomField();
     $g->name = 'totally_unique_name';
     $g->format = 'IP';
     $g->element = "text";
     //$this->assertTrue($g->validate($g->toArray()));
     $this->assertTrue(CustomField::saving($g));
     /*$this->assertThrows(function () {
         $f->save();
       });*/
 }
开发者ID:rrsc,项目名称:snipe-it,代码行数:22,代码来源:CustomFieldTest.php

示例14: Form_PreRender

 protected function Form_PreRender()
 {
     $objExpansionMap[CustomField::ExpandCreatedByObject] = true;
     // Get Total Count b/c of Pagination
     $this->dtgCustomField->TotalItemCount = CustomField::CountAll();
     if ($this->dtgCustomField->TotalItemCount == 0) {
         $this->dtgCustomField->ShowHeader = false;
     } else {
         $objClauses = array();
         if ($objClause = $this->dtgCustomField->OrderByClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = $this->dtgCustomField->LimitClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = QQ::Expand(QQN::CustomField()->CreatedByObject)) {
             array_push($objClauses, $objClause);
         }
         $this->dtgCustomField->DataSource = CustomField::LoadAll($objClauses);
         $this->dtgCustomField->ShowHeader = true;
     }
 }
开发者ID:heshuai64,项目名称:einv2,代码行数:22,代码来源:custom_field_list.php

示例15: setAttributeMetadataFromForm

 public function setAttributeMetadataFromForm(AttributeForm $attributeForm)
 {
     assert('$attributeForm instanceof DropDownAttributeForm');
     $modelClassName = get_class($this->model);
     $attributeName = $attributeForm->attributeName;
     $attributeLabels = $attributeForm->attributeLabels;
     $defaultValueOrder = $attributeForm->defaultValueOrder;
     $elementType = $attributeForm->getAttributeTypeName();
     $partialTypeRule = $attributeForm->getModelAttributePartialRule();
     $isRequired = (bool) $attributeForm->isRequired;
     $isAudited = (bool) $attributeForm->isAudited;
     $customFieldDataName = $attributeForm->customFieldDataName;
     if ($customFieldDataName == null) {
         $customFieldDataName = ucfirst(strtolower($attributeForm->attributeName));
         //should we do something else instead?
     }
     $customFieldDataData = $attributeForm->customFieldDataData;
     $customFieldDataLabels = $attributeForm->customFieldDataLabels;
     $defaultValue = DropDownDefaultValueOrderUtil::getDefaultValueFromDefaultValueOrder($defaultValueOrder, $customFieldDataData);
     ModelMetadataUtil::addOrUpdateCustomFieldRelation($modelClassName, $attributeName, $attributeLabels, $defaultValue, $isRequired, $isAudited, $elementType, $customFieldDataName, $customFieldDataData, $customFieldDataLabels);
     if ($attributeForm->getCustomFieldDataId() != null) {
         $oldAndNewValuePairs = array();
         foreach ($attributeForm->customFieldDataData as $order => $newValue) {
             if (isset($attributeForm->customFieldDataDataExistingValues[$order]) && $attributeForm->customFieldDataDataExistingValues[$order] != $newValue) {
                 CustomField::updateValueByDataIdAndOldValueAndNewValue($attributeForm->getCustomFieldDataId(), $attributeForm->customFieldDataDataExistingValues[$order], $newValue);
                 $oldValue = $attributeForm->customFieldDataDataExistingValues[$order];
                 $oldAndNewValuePairs[$oldValue] = $newValue;
             }
         }
         if (count($oldAndNewValuePairs) > 0) {
             DropDownDependencyDerivedAttributeDesignerUtil::updateValueInMappingByOldAndNewValue($modelClassName, $attributeName, $oldAndNewValuePairs, $attributeForm->customFieldDataDataExistingValues[$order], $newValue);
         }
         DropDownDependencyDerivedAttributeDesignerUtil::resolveValuesInMappingWhenValueWasRemoved($modelClassName, $attributeName, $attributeForm->customFieldDataData);
     }
     $this->resolveDatabaseSchemaForModel($modelClassName);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:36,代码来源:DropDownModelAttributesAdapter.php


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