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


PHP Relationship::Load方法代码示例

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


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

示例1: SetupPanel

 protected function SetupPanel()
 {
     // Get and Validate the Marriage Object
     $this->objRelationship = Relationship::Load($this->strUrlHashArgument);
     if (!$this->objRelationship) {
         // Trying to create a NEW relationship
         $this->objRelationship = new Relationship();
         $this->objRelationship->Person = $this->objPerson;
         $this->blnEditMode = false;
         $this->btnSave->Text = 'Create';
     } else {
         // Ensure the Relationship object belongs to the person
         if ($this->objRelationship->PersonId != $this->objPerson->Id) {
             return $this->ReturnTo('#general/view_family');
         }
         $this->blnEditMode = true;
         $this->btnSave->Text = 'Update';
         $this->btnDelete = new QLinkButton($this);
         $this->btnDelete->Text = 'Delete';
         $this->btnDelete->CssClass = 'delete';
         $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to permenantly DELETE this record?'));
         $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
         $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
     }
     // Create Controls
     $this->lstRelation = new QListBox($this);
     $this->lstRelation->Name = 'Relationship';
     if (!$this->objRelationship->RelationshipTypeId) {
         $this->lstRelation->AddItem('- Select One -', null);
     }
     $this->lstRelation->Required = true;
     foreach (RelationshipType::$NameArray as $intId => $strName) {
         $this->lstRelation->AddItem($strName, $intId, $intId == $this->objRelationship->RelationshipTypeId);
     }
     // Create "Married To" Controls
     if ($this->objRelationship->RelatedToPerson) {
         $this->lblRelatedTo = new QLabel($this);
         $this->lblRelatedTo->Name = 'Related To';
         $this->lblRelatedTo->Text = $this->objRelationship->RelatedToPerson->LinkHtml;
         $this->lblRelatedTo->HtmlEntities = false;
     } else {
         $this->pnlRelatedTo = new SelectPersonPanel($this);
         $this->pnlRelatedTo->Name = 'Related To';
         $this->pnlRelatedTo->AllowCreate = true;
         $this->pnlRelatedTo->Required = true;
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:47,代码来源:Vicp_GeneralProfile_EditFamily.class.php

示例2: Create

 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this RelationshipMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Relationship object creation - defaults to CreateOrEdit
  * @return RelationshipMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objRelationship = Relationship::Load($intId);
         // Relationship was found -- return it!
         if ($objRelationship) {
             return new RelationshipMetaControl($objParentObject, $objRelationship);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Relationship object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new RelationshipMetaControl($objParentObject, new Relationship());
 }
开发者ID:alcf,项目名称:chms,代码行数:34,代码来源:RelationshipMetaControlGen.class.php

示例3: Reload

 /**
  * Reload this Relationship from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved Relationship object.');
     }
     // Reload the Object
     $objReloaded = Relationship::Load($this->intId);
     // Update $this's local variables to match
     $this->PersonId = $objReloaded->PersonId;
     $this->RelatedToPersonId = $objReloaded->RelatedToPersonId;
     $this->RelationshipTypeId = $objReloaded->RelationshipTypeId;
 }
开发者ID:alcf,项目名称:chms,代码行数:17,代码来源:RelationshipGen.class.php


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