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


PHP error::createConnectionNotFoundError方法代码示例

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


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

示例1: load

 /**
  * Loads the data for the connection from the database
  *
  * @param String $style (optional - default 'long') may be 'short' or 'long' of 'cif'
  * @return Connection object (this) or Error
  */
 function load($style = 'long')
 {
     global $DB, $CFG, $HUB_SQL;
     try {
         $this->canview();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $this->style = $style;
     $params = array();
     $params[0] = $this->connid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT, $params);
     $count = count($resArray);
     if ($count == 0) {
         $ERROR = new error();
         $ERROR->createConnectionNotFoundError($this->connid);
         return $ERROR;
     }
     $fromid = 0;
     $toid = 0;
     for ($i = 0; $i < $count; $i++) {
         $array = $resArray[$i];
         $fromid = trim($array['FromID']);
         $toid = trim($array['ToID']);
         $this->fromcontexttypeid = trim($array['FromContextTypeID']);
         $this->tocontexttypeid = trim($array['ToContextTypeID']);
         $this->creationdate = trim($array['CreationDate']);
         $this->modificationdate = trim($array['ModificationDate']);
         $this->userid = trim($array['UserID']);
         $this->users = array();
         $this->users[0] = getUser($this->userid, $style);
         $this->linktypeid = trim($array['LinkTypeID']);
         $this->private = $array['Private'];
         $this->description = $array['Description'];
     }
     //now add in from/to nodes
     $from = new CNode($fromid);
     $this->from = $from->load($style);
     // we need to for the resource node title
     // $this->from->description = ""; // we don't need the long descriptions on connections - even if style for rest is long
     $to = new CNode($toid);
     $this->to = $to->load($style);
     // we need to for the resource node title
     //$this->to->description = ""; // we don't need the long descriptions on connections - even if style for rest is long
     $r = new Role($this->fromcontexttypeid);
     $this->fromrole = $r->load();
     $r = new Role($this->tocontexttypeid);
     $this->torole = $r->load();
     //If both ends of the connection are Comments, it's part of a chat tree.
     //and if the description holds a nodeid, load it as the parent item the chat is against
     if (isset($this->fromrole->name) && $this->fromrole->name == "Comment" || isset($this->torole->name) && $this->torole->name == "Comment") {
         if (isset($this->description) && $this->description != "") {
             // the description could hold a list of id'd id1:id2:id3 etc
             // if it does, the first item is the one to use.
             //echo $this->description;
             $reply = split(":", $this->description);
             $id = $reply[0];
             if ($reply[0] == "") {
                 $id = $reply[1];
             }
             $parentnode = new CNode($id);
             $parentnode = $parentnode->load();
             if (!$parentnode instanceof Error) {
                 $this->parentnode = $parentnode;
             }
         }
     }
     $l = new LinkType($this->linktypeid);
     $this->linktype = $l->load();
     if ($style == 'long') {
         // add in the groups
         $resArray2 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_GROUP, $params);
         $count2 = count($resArray2);
         if ($count2 > 0) {
             $this->groups = array();
             for ($i = 0; $i < $count2; $i++) {
                 $array = $resArray2[$i];
                 $group = new Group(trim($array['GroupID']));
                 array_push($this->groups, $group->load());
             }
         }
         //now add in any tags
         $resArray3 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_TAGS, $params);
         $count3 = count($resArray3);
         if ($count3 > 0) {
             $this->tags = array();
             for ($i = 0; $i < $count3; $i++) {
                 $array = $resArray3[$i];
                 $tag = new Tag(trim($array['TagID']));
                 array_push($this->tags, $tag->load());
             }
         }
     }
     if ($style != 'cif') {
//.........这里部分代码省略.........
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:101,代码来源:connection.class.php

示例2: load

 /**
  * Loads the data for the connection from the database
  *
  * @param String $style (optional - default 'long') may be 'short' or 'long' of 'cif'
  * @return Connection object (this) or Error
  */
 function load($style = 'long')
 {
     global $DB, $CFG, $HUB_SQL;
     try {
         $this->canview();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $this->style = $style;
     $params = array();
     $params[0] = $this->connid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT, $params);
     $count = count($resArray);
     if ($count == 0) {
         $ERROR = new error();
         $ERROR->createConnectionNotFoundError($this->connid);
         return $ERROR;
     }
     $fromid = 0;
     $toid = 0;
     for ($i = 0; $i < $count; $i++) {
         $array = $resArray[$i];
         $fromid = trim($array['FromID']);
         $toid = trim($array['ToID']);
         $this->fromcontexttypeid = trim($array['FromContextTypeID']);
         $this->tocontexttypeid = trim($array['ToContextTypeID']);
         $this->creationdate = trim($array['CreationDate']);
         $this->modificationdate = trim($array['ModificationDate']);
         $this->userid = trim($array['UserID']);
         $this->users = array();
         $this->users[0] = getUser($this->userid, $style);
         $this->linktypeid = trim($array['LinkTypeID']);
         $this->private = $array['Private'];
         $this->description = $array['Description'];
     }
     //now add in from/to nodes. Try from the cache first?
     $from = new CNode($fromid);
     $this->from = $from->load($style);
     $to = new CNode($toid);
     $this->to = $to->load($style);
     $r = new Role($this->fromcontexttypeid);
     $this->fromrole = $r->load();
     $r = new Role($this->tocontexttypeid);
     $this->torole = $r->load();
     $l = new LinkType($this->linktypeid);
     $this->linktype = $l->load();
     if ($style == 'long') {
         // add in the groups
         $resArray2 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_GROUP, $params);
         $count2 = count($resArray2);
         if ($count2 > 0) {
             $this->groups = array();
             for ($i = 0; $i < $count2; $i++) {
                 $array = $resArray2[$i];
                 $group = new Group(trim($array['GroupID']));
                 array_push($this->groups, $group->load());
             }
         }
         //now add in any tags
         $resArray3 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_TAGS, $params);
         $count3 = count($resArray3);
         if ($count3 > 0) {
             $this->tags = array();
             for ($i = 0; $i < $count3; $i++) {
                 $array = $resArray3[$i];
                 $tag = new Tag(trim($array['TagID']));
                 array_push($this->tags, $tag->load());
             }
         }
     }
     if ($style != 'cif') {
         $this->loadVotes();
     }
     return $this;
 }
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:81,代码来源:connection.class.php


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