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


PHP Package::LoadByToken方法代码示例

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


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

示例1: Form_Create

 protected function Form_Create()
 {
     parent::Form_Create();
     $this->objPackage = Package::LoadByToken(QApplication::PathInfo(0));
     if (!$this->objPackage) {
         QApplication::Redirect('/qpm/');
     }
     $this->strPageTitle .= $this->objPackage->Name;
     $this->dtgContributions = new PackageContributionDataGrid($this);
     $this->dtgContributions->SetDataBinder('dtgContributions_Bind');
     $this->dtgContributions->AlternateRowStyle->CssClass = 'alternate';
     $this->dtgContributions->MetaAddColumn(QQN::PackageContribution()->Person->Username, 'Name=QPM Path for Version', 'Html=<?= $_FORM->RenderPath($_ITEM); ?>', 'Width=350px', 'VerticalAlign=top', 'FontNames=Monaco, Courier, Courier New,Monospaced', 'HtmlEntities=false');
     $this->dtgContributions->MetaAddColumn(QQN::PackageContribution()->CurrentPackageVersion->Notes, 'Name=Version Notes', 'Html=<?= $_FORM->RenderNotes($_ITEM); ?>', 'Width=400px', 'VerticalAlign=top', 'CssClass=small', 'HtmlEntities=false');
     $this->dtgContributions->MetaAddColumn('CurrentPostDate', 'Name=Posted', 'Width=100px', 'VerticalAlign=top');
     $this->dtgContributions->MetaAddColumn(QQN::PackageContribution()->Person->DisplayName, 'Name=By', 'Html=<?= $_FORM->RenderPostedBy($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px', 'CssClass=reverseLink', 'VerticalAlign=top');
     $this->dtgContributions->SortColumnIndex = 2;
     $this->dtgContributions->SortDirection = 1;
     $this->dtgContributions->Paginator = new QPaginator($this->dtgContributions);
     if ($this->objPackage->IsEditableForPerson(QApplication::$Person)) {
         $this->btnEdit = new RoundedLinkButton($this);
         $this->btnEdit->CssClass = 'searchOption';
         $this->btnEdit->ToolTip = 'Edit This package';
         $this->btnEdit->LinkUrl = '/qpm/edit.php/' . $this->objPackage->Token;
     }
     // Setup messages panel
     if ($this->objPackage->PackageCategory->Token != 'issues') {
         $this->pnlMessages = new MessagesPanel($this);
         $this->pnlMessages->SelectTopic($this->objPackage->TopicLink->GetTopic());
         $this->pnlMessages->lblTopicInfo_SetTemplate(__INCLUDES__ . '/messages/lblTopicInfoForPackage.tpl.php');
         $this->pnlMessages->btnRespond1->Text = 'Post Comment';
         $this->pnlMessages->btnRespond2->Text = 'Post Comment';
         $this->pnlMessages->strAdditionalCssClass = 'topicForPackage';
         if (array_key_exists('lastpage', $_GET)) {
             $this->pnlMessages->SetPageNumber(QPaginatedControl::LastPage);
         }
     } else {
         $strTokenParts = explode('_', $this->objPackage->Token);
         if (count($strTokenParts) == 2) {
             $strIssueNumber = $strTokenParts[1];
         } else {
             $strIssueNumber = null;
         }
         $this->pnlMessages = new QPanel($this);
         $this->pnlMessages->CssClass = 'topic topicForPackage';
         $this->pnlMessages->Text = '<h1>Comments</h1>';
         $this->pnlMessages->Text .= '<br/>Comments for this issue-related QPM package have been disabled on this screen.  To view, post and edit comments, ';
         $this->pnlMessages->Text .= 'please do so on the <a href="/issues/view.php/' . $strIssueNumber . '">issue page</a>, itself.';
     }
 }
开发者ID:qcodo,项目名称:qcodo-website,代码行数:49,代码来源:package.php

示例2: GetPackageVersionCount

 /**
  * Looks up a package version count given the PackageName and User.
  * This will throw an exception if the Package or Username does not exist
  * @param string $strPackageName
  * @param string $strUsername
  * @return integer
  */
 public function GetPackageVersionCount($strPackageName, $strUsername)
 {
     $objPackage = Package::LoadByToken(trim(strtolower($strPackageName)));
     if (!$objPackage) {
         throw new Exception('Package does not exist');
     }
     $objPerson = Person::LoadByUsername(trim(strtolower($strUsername)));
     if (!$objPerson) {
         throw new Exception('Person does not exist');
     }
     $objPackageContribution = PackageContribution::LoadByPackageIdPersonId($objPackage->Id, $objPerson->Id);
     if (!$objPackageContribution) {
         return 0;
     }
     return $objPackageContribution->CountPackageVersions();
 }
开发者ID:klucznik,项目名称:qcodo-website,代码行数:23,代码来源:1_0.php

示例3: Form_Validate

 public function Form_Validate($blnToReturn = true)
 {
     $this->txtToken->Text = Package::SanitizeForToken($this->txtToken->Text);
     if ($this->txtToken->Text == 'manifest') {
         $this->txtToken->Warning = 'Invalid QPM package name: "manifest" cannot be used';
         $blnToReturn = false;
     } else {
         if (substr($this->txtToken->Text, 0, 6) == 'issue_') {
             $this->txtToken->Warning = 'Invalid QPM package name: cannot begin with "issue_"';
             $blnToReturn = false;
         } else {
             $objPackage = Package::LoadByToken($this->txtToken->Text);
             if ($objPackage && $objPackage->Id != $this->mctPackage->Package->Id) {
                 $this->txtToken->Warning = 'QPM package name already exists';
                 $blnToReturn = false;
             }
         }
     }
     return parent::Form_Validate($blnToReturn);
 }
开发者ID:qcodo,项目名称:qcodo-website,代码行数:20,代码来源:edit.php

示例4: while

    $strFirstMessageText = QDataGen::GenerateContent(rand(1, 5));
    $objPerson = Person::Load(rand(1, $intMaxPersonId));
    $dttDateTime = QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
    $objTopic = $objForum->PostTopic($strName, $strFirstMessageText, $objPerson, $dttDateTime);
    $objForumTopicArray[] = $objTopic;
}
//////////////////////
// Qcodo Package Manager
//////////////////////
$objPackageCategories = PackageCategory::QueryArray(QQ::NotEqual(QQN::PackageCategory()->Token, 'issues'));
while (QDataGen::DisplayWhileTask('Generating QPM Packages...', GENERATE_QPM)) {
    $objPackage = new Package();
    $objPackage->PackageCategory = QDataGen::GenerateFromArray($objPackageCategories);
    $objPackage->Name = QDataGen::GenerateTitle(1, 3);
    $objPackage->Token = Package::SanitizeForToken($objPackage->Name);
    while (Package::LoadByToken($objPackage->Token)) {
        $objPackage->Name = QDataGen::GenerateTitle(1, 3);
        $objPackage->Token = Package::SanitizeForToken($objPackage->Name);
    }
    $objPackage->Description = QDataGen::GenerateContent(rand(1, 3), 20, 80);
    $objPackage->Save();
    $objPackage->CreateTopicAndTopicLink(Person::Load(rand(1, $intMaxPersonId)));
    $intContributionCount = rand(1, 10);
    for ($intContribution = 0; $intContribution < $intContributionCount; $intContribution++) {
        while (PackageContribution::LoadByPackageIdPersonId($objPackage->Id, $objPerson->Id)) {
            $objPerson = Person::Load(rand(1, $intMaxPersonId));
        }
        $intVersionCount = rand(1, 4);
        $dttEndRange = QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
        $dttEndRange = QDataGen::GenerateDateTime($dttStartDate, $dttEndRange);
        $dttEndRange = QDataGen::GenerateDateTime($dttStartDate, $dttEndRange);
开发者ID:qcodo,项目名称:qcodo-website,代码行数:31,代码来源:data-loader.cli.php


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